how to use the listbox value to update textbox

user1921704

I have an Access form with a list-box consisting of two columns and its MultiSelect property is set to None. I need to update 2 text-box using this list-box where if the user select an item from it the value of its first column is used to update one text-box and the value of the second column is used to update another text-box , something like :

Private Sub listbox_AfterUpdate()

Dim colval1 As String
Dim colval2 As String

colval1 = Me.listbox.column(1).Value
colval2 = Me.listbox.column(2).Value

Me.[textbox1] = colval1 
Me.[textbox2] = colval2 


End Sub

I just don't know how to get the value of this list-box.

HansUp

List box column numbering starts from zero, so the first column value is accessible as Me.listbox.Column(0). Access throws an error ("object required") when you append .Value after the column.

Also you shouldn't need variables to store the column values before you assign them to the text boxes. You can assign the column values to the text boxes directly.

Private Sub listbox_AfterUpdate()
    Me.[textbox1] = Me.listbox.Column(0)
    Me.[textbox2] = Me.listbox.Column(1)
End Sub

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to update my textbox total price which is in listbox

From Dev

XAML ListBox to TextBox Update code

From Dev

Listbox Sorting based on TextBox value

From Dev

Update textbox value $on event

From Dev

Listbox DataTemplate clear textbox value on selection

From Dev

check if a textbox value already exists in a listbox

From Dev

Auto calculate textbox has a value of zero when emptying textbox for listbox

From Dev

How to use a double click event to click text in a listbox to make that text appear in a empty textbox

From Dev

How to Update a Listbox from another Listbox

From Dev

How to update the textbox value based on selectbox using JavaScript?

From Dev

How can I use a textbox value to set a value on a radiobutton

From Dev

How to dynamically position a listbox in relation to textbox in winforms

From Dev

How to Split Textbox Text to Listbox C#

From Dev

How to Get Listbox item in textbox with mouse click?

From Dev

How to find items in listbox using Textbox( localdatabase )

From Dev

How to send textfile string to textbox using listbox?

From Dev

Update TextBox Value on history back

From Dev

Excel VBA: Searching for value in listbox based on value set in textbox

From Dev

Excel VBA: Searching for value in listbox based on value set in textbox

From Dev

How Do I pass back value from form2 textbox to listbox value in forn1 c#

From Dev

How to update dataset from listbox

From Dev

Update scope value after dynamically update textbox

From Dev

How to use International place Value System on HTML TextBox

From Dev

How do I get the value/input of a textbox to use in js?

From Dev

Update TextArea value based on number of listbox selections

From Dev

Data Binding so that changing a TextBox value updates the LIstBox

From Dev

Data Binding so that changing a TextBox value updates the LIstBox

From Dev

How to use Coldfusion json data to match textbox input and display value in second textbox

From Dev

How to count the value in textbox?

Related Related

  1. 1

    how to update my textbox total price which is in listbox

  2. 2

    XAML ListBox to TextBox Update code

  3. 3

    Listbox Sorting based on TextBox value

  4. 4

    Update textbox value $on event

  5. 5

    Listbox DataTemplate clear textbox value on selection

  6. 6

    check if a textbox value already exists in a listbox

  7. 7

    Auto calculate textbox has a value of zero when emptying textbox for listbox

  8. 8

    How to use a double click event to click text in a listbox to make that text appear in a empty textbox

  9. 9

    How to Update a Listbox from another Listbox

  10. 10

    How to update the textbox value based on selectbox using JavaScript?

  11. 11

    How can I use a textbox value to set a value on a radiobutton

  12. 12

    How to dynamically position a listbox in relation to textbox in winforms

  13. 13

    How to Split Textbox Text to Listbox C#

  14. 14

    How to Get Listbox item in textbox with mouse click?

  15. 15

    How to find items in listbox using Textbox( localdatabase )

  16. 16

    How to send textfile string to textbox using listbox?

  17. 17

    Update TextBox Value on history back

  18. 18

    Excel VBA: Searching for value in listbox based on value set in textbox

  19. 19

    Excel VBA: Searching for value in listbox based on value set in textbox

  20. 20

    How Do I pass back value from form2 textbox to listbox value in forn1 c#

  21. 21

    How to update dataset from listbox

  22. 22

    Update scope value after dynamically update textbox

  23. 23

    How to use International place Value System on HTML TextBox

  24. 24

    How do I get the value/input of a textbox to use in js?

  25. 25

    Update TextArea value based on number of listbox selections

  26. 26

    Data Binding so that changing a TextBox value updates the LIstBox

  27. 27

    Data Binding so that changing a TextBox value updates the LIstBox

  28. 28

    How to use Coldfusion json data to match textbox input and display value in second textbox

  29. 29

    How to count the value in textbox?

HotTag

Archive