ListBox.CellClick question

Hello all,

I have created a simple test app with a Listbox and TextArea. Listbox is named “List_Items”.

What I am trying to achieve is when I click on the first row. the Textarea1.text should say “Test 0” and if I click on row 2, the Textarea1.text should read “Test 1”.

But when I click on the first row, nothing shows in the TextArea. When i click on the second row. it says “Test 0” in the Textarea. But when I double click on the row. it displays what I intended it to display.

How do i have it where it displays my text on a single click, and display the right text.

On the ListBox(List_Items) cellclick i have

If List_Items.Selected(0) = True then
  TextArea1.text = "Test 0"
end if

If List_Items.Selected(1) = True then
  TextArea1.text = "Test 1"
end if

If List_Items.Selected(2) = True then
  TextArea1.text = "Test 2"
end if

If List_Items.Selected(3) = True then
  TextArea1.text = "Test 3"
end if

If List_Items.Selected(4) = True then
  TextArea1.text = "Test 4"
end if

on the open event on the window i have

Var MyList() as String

MyList.add("Test0")
MyList.add("Test1")
MyList.add("Test2")
MyList.add("Test3")
MyList.add("Test4")

Var Item as String
for each item in MyList
  List_Items.AddRow(item)
next

any help would be greatly appreciated.

Move the code to the Change event handler for the list box.

1 Like

Yup, That did it. Thank you Justin!

1 Like