Question:
Visual Basic Listbox Help 10* best answer?
Nico
2012-02-26 08:22:21 UTC
Hi guys,

I have created a Listbox and have entered information in them e.g. First line , Apple second line, Bannana etc....

Now i also have 2 textboxes in my windows form.

This is what i want.
When i click a word on the Listbox e.g. Apple the 2 textboxes should be filled in with the word "Apple" or when i click Bannana the 2 textboxes should include "Bannana".

I know my grammar is bad on this question, im just in a hurry anyone who gives me my answer gets 10*...


Thank you and please no time wasters!



PS: This is in Microsoft Visual Basic 2010 Express edition...
Three answers:
Ankit
2012-02-26 08:32:00 UTC
1. Double click on your listbox in design view. This will take you to a function that will handle the SelectedIndexChanged Event of the listbox.

2. In the function body, write

textBox1.Text = listBox1.SelectedItem.ToString()

textBox2.Text = textBox1.Text

(Assuming the names of your listbox and texboxes are listbox1, textbox1 and textbox2)

3.Done :)
?
2016-10-01 15:20:36 UTC
i = i -2 potential take despite the fee of i is and subtract 2 from it elect Case i This says we can do one among countless issues, reckoning on the fee of i Case 0 do this code if the fee of i is 0. it relatively is going to execute each and every thing from here to the subsequent Case or end elect fact. s = s & "exciting" this could take the string s (which includes "VB is ") and append the notice exciting to the tip of it.
anonymous
2012-02-26 08:23:44 UTC
Depends on the program and the teacher's instructions


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...