Ask Experts Questions for FREE Help !
Ask
    habydlg's Avatar
    habydlg Posts: 1, Reputation: 1
    New Member
     
    #1

    Jun 25, 2012, 08:09 AM
    VB.NET listbox question
    Greetings,

    I need to access a certain item in a listbox and then save it to a textbox. For example, I have a listbox with 5 items and 5 textboxes, and I need one item per textbox. What is the code necessary to access individual items in a textbox?
    jsblume's Avatar
    jsblume Posts: 13, Reputation: 2
    New Member
     
    #2

    Sep 28, 2012, 10:31 AM
    I don't know if you have an answer yet or not, but it all depends on how the data is bound to the ListBox.

    You can access a specific item in a ListBox using the Items() collection:

    ListBox.Items(0) for the first item in the list.

    If the data is an array of String:

    TextBox1.Text = ListBox.Items(0)

    If the data is a DataTable:

    TextBox1.Text = DirectCast(ListBox1.Items(0), DataRowView).Item(<column name or number>)

    If the data is a custom object:

    TextBox1.Text = DirectCast(ListBox1.Items(0), CustomObject).PropertyName

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Sample question of net present value? [ 1 Answers ]

Abe Sdn Bhd is trying to select the best investment from among 3 alternatives. Each alternative involve are initial outlay of RM100,000. Their cash flows are return for each projects are as follows: year project A project B project C 1 RM 10,000 RM 50,000 RM 0 2 ...

Help with Net Present Value question with immediate write off? [ 0 Answers ]

Hi I have the following Net Present Value question: New 10 year project - Investments required: - Patent (Cost $1.5 million) depreciated Straight Line @ 25% - Software (Cost $1 million) immediately written off - Additional Net working capital =$200,000 Sales (units) - 5000(year 1), and...

Fate of Net Income Question [ 0 Answers ]

If there is an error in the ending inventory affecting the net income of the current period, what will happen to the net income of the next accounting period? If net income was overstated in the current period, it will be overstated in the next period. Cannot be determined from the...

ListBox and Textbox in VB.NET 2008! [ 4 Answers ]

Hello everyone. Ok so I have in form1 a listbox1 and a textbox1. In the listbox1 I have several items and I want while I type something in the textbox1 it gives me all the similar in listbox1. For Example: I already have in listbox1 the item 'ASKME HELPDESK'. When I type in the textbox1...

Listbox and textbox in vb.net [ 3 Answers ]

Hi there, I wonder if anyone can help. I have a listbox and a textbox. At runtime I already have a list of items in the listbox. When I double click on these items its needs to appear in the textbox. At the moment I have the code that, when I double click on the item in the listbox ONLY one item...


View more questions Search