Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using substring in report

Status
Not open for further replies.

mogura

Programmer
Sep 6, 2003
22
GB
I have a list of 24 digit strings that have been written to a textfile using the streamwriter function and I now want display each string split under a series of columns. At the moment I can display the list of strings in a rich textbox using the following code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim line, alltext As String

Dim sr As StreamReader = New StreamReader ("c:\report.txt")
Do
line = sr.ReadLine()
alltext = alltext & line & vbCrLf
textReport.Text = alltext

Loop Until line Is Nothing
sr.Close()

End Sub
End Class


How can I use substring to, for example, list the first 5 digits under the column 'Ref No', the sixth digit under the column 'Type' and so on?

The MSDN help is proving confusing. Can anyone help?
 
Try using a DataTable and just add the substring to the relevant column in the DataTable.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top