-
Sep 26th, 2014, 06:10 PM
#1
Thread Starter
Member
[RESOLVED] ¿How to read text separated by a comma to textbox?
-
Sep 26th, 2014, 06:33 PM
#2
Re: ¿How to read text separated by a comma to textbox?
Does this help?
Code:
Public Class Form1
' array to hold 2 List Of Textbox
Private textBoxGroup(1) As List(Of TextBox)
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' add our text boxes to the textBoxGroup array
textBoxGroup(0) = New List(Of TextBox) From {TextBox1, TextBox2, TextBox3}
textBoxGroup(1) = New List(Of TextBox) From {TextBox4, TextBox5, TextBox6}
End Sub
' set textboxes from file
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
' load file by lines to array
Dim filename As String = "test.txt"
Dim lines() As String = IO.File.ReadAllLines(filename)
' loop thru lines
For i = 0 To lines.Count - 1
' split items in this line by comma char.
Dim items() As String = lines(i).Split({","c}, StringSplitOptions.RemoveEmptyEntries)
' add items to our textboxes
For n = 0 To items.Count - 1
textBoxGroup(i).Item(n).Text = items(n)
Next
Next
End Sub
End Class
-
Sep 26th, 2014, 07:34 PM
#3
Thread Starter
Member
Re: ¿How to read text separated by a comma to textbox?
omg Thanks you very much @Edgemeal, this working fantastic!!!
Thanks you for you time in help me!!!
Many greeting from Colombia, and have a nice day Brother
jejej you are VB For Fun
Thread Resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|