How to display text from a text file in labels which are created
dynamically depending on number of lines in the text file using vb.net
Below is my code. I have a text file "D:\1.txt" which contains some text
in lines. i want to display each line as a label in a Tabcontrol Tabpage.
But using this code I am only able to create the first line as a label.
The other lines are not displayed.THIS code is triggered during a form
load.
Dim FILE_NAME As String = "D:\1.txt"
For Each line As String In System.IO.File.ReadAllLines(FILE_NAME)
Dim label1 As New Label
label1.Text = line
TabPage2.Controls.Add(label1)
Next
Can anyone help me?
No comments:
Post a Comment