Thursday, 15 September 2011

Read Text from file and put the in the TextBox in vb.net -



Read Text from file and put the in the TextBox in vb.net -

i got info text file follows:

kill mad jog jug

from above info want set text "kill" in textbox 1, text "mad" in textbox 2, text "jog" in textbox 3, , "jug" in textbox 4 next screenshot click here

so, can help me ?

dim lines = file.readalllines(path) textbox1.text = lines.elementatordefault(0) textbox2.text = lines.elementatordefault(1) textbox3.text = lines.elementatordefault(2) textbox4.text = lines.elementatordefault(3)

you utilize indexer(f.e. lines(0)) of array instead of elementatordefault. latter has advantage doesn't throw exception if there fewer elements.

however, utilize listbox instead or single textbox multiline=true:

textbox1.lines = file.readalllines(path)

vb.net

No comments:

Post a Comment