Listbox And Textbox

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts Page 1 of 1
Contributors
User avatar
upperdrag
Excellent Poster
Excellent Poster
Posts: 321
Joined: Fri Mar 12, 2010 12:05 pm

Listbox And Textbox
upperdrag
hello people :)
Sorry to bother u all again however i need another help (yet again)

how do you make a listbox so that when you click on the selected index, the text will be loaded? and when you click on another index, another index,another text will be shown??
oh and also how can i read the textfile from a .txt? For example

----
Bears
------
Birds



I Click On Birds

All THe Information will be shown about bird, However i wanna to read the information through a txt file..? how is that possible??
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Listbox And Textbox
mandai
This should work:
Code: Select all
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        TextBox1.Text = ListBox1.Text
    End Sub
When you say read through do you mean read each line? You can use IO.File.ReadAllLines for that.
User avatar
upperdrag
Excellent Poster
Excellent Poster
Posts: 321
Joined: Fri Mar 12, 2010 12:05 pm

Re: Listbox And Textbox
upperdrag
im sorry but i know all of those however, how am i suppose to read it and save it with Commas for example













Bear
--------
Bird
--------


I Click On Bird, it reads from a textfile

and the textfile will be like






Birds Are Under Bird Category ,Bears Are Under Mammals Category


The Text will show "Birds Are Under Bird Category"


And The Listbox Reads From The Textfile too so it will be like

Birds,Bears
3 posts Page 1 of 1
Return to “Tutorial Requests”