Read/Split
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.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Hello,
can anyone give us a great sample for reading a file and split the all lines with a char?
so the files will has for example:
0|test|test
and we wanna split it to add them in separated textboxen
we have this but no idea how to use it with a file to read
so this must be used aswell.
anyone please?
can anyone give us a great sample for reading a file and split the all lines with a char?
so the files will has for example:
0|test|test
and we wanna split it to add them in separated textboxen
we have this but no idea how to use it with a file to read
so this must be used aswell.
anyone please?
Code: Select all
thank youDim data As String = Nothing
Using reader As StreamReader = New StreamReader(ReadFile)
Do While Not reader.EndOfStream
data &= vbNewLine & reader.ReadLine
Loop
End Using
For Each codePart As String In data.Split("|")
If (codePart.Trim).Length > 0 Then
'here it will be all transfered to split them in text boxen
End If
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
You mean something like this?
Code: Select all
Using OPF As OpenFileDialog = New OpenFileDialog()
If (OPF.ShowDialog() = Windows.Forms.DialogResult.OK) Then
For Each TextLine As String In IO.File.ReadAllText(OPF.FileName).Split("|")
If (TextLine.Trim().Length > 0) Then
'Do what ever you want with the line
End If
Next
End If
End Using
You can find me on Facebook or on Skype mihai_92b
hello #XTechVB
well it seems it does nothing :(
i mean it doesn't add them into the text boxen
well it seems it does nothing :(
i mean it doesn't add them into the text boxen
Code: Select all
For Each TextLine As String In IO.File.ReadAllText(OPF.FileName).Split("|")
If (TextLine.Trim().Length > 0) Then
AddTextbox(TextLine.Trim)
'Do what ever you want with the line
End If
Next
Code: Select all
Public Sub AddTextbox(ByVal text As String)
Dim index As Integer = 0
Dim Array_ As TextBox() = New TextBox() {Me.e1, Me.e2, Me.e3}
Dim box As TextBox
For Each box In Array_
box.Text = text(index)
index += 1
Application.DoEvents()
Next
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Can you post the full code for the "AddTextbox" function? or send it via pm?
You can find me on Facebook or on Skype mihai_92b
Thanks #XTechVB
i fix it
was my fault with your code :lol:
+rep
i fix it
was my fault with your code :lol:
+rep
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023