| | |
how to read data from text file into data grid???
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Aug 2006
Posts: 7
Reputation:
Solved Threads: 0
i need to create a system to read the txt file data to datagrid
but i just know read by line.
that say the sample.txt file pettern as below:
date time price
1/8 2:15pm $5.00
2/8 3:20pm $6.00
how i going to fill the data separate by date, time, and price??
means read by row n column....n fill into datagrid....
thanks....
if got sample to show then will be more better....:lol:
but i just know read by line.
that say the sample.txt file pettern as below:
date time price
1/8 2:15pm $5.00
2/8 3:20pm $6.00
how i going to fill the data separate by date, time, and price??
means read by row n column....n fill into datagrid....
thanks....
if got sample to show then will be more better....:lol:
Hi
It looks like you have a set of " " between the columns, so what i would do is split each line one at a time, something like this:
that will create an array with the data what you want. Probably you will have to trim each line to get rid of the empty spaces.
Hope it helps
Regards
It looks like you have a set of " " between the columns, so what i would do is split each line one at a time, something like this:
VB.NET Syntax (Toggle Plain Text)
'after you read the line Dim myArray As Array myArray = Split(line, " ")
that will create an array with the data what you want. Probably you will have to trim each line to get rid of the empty spaces.
Hope it helps
Regards
Then you split the array when ":" is found.
regards
VB.NET Syntax (Toggle Plain Text)
'after you read the line Dim myArray As Array myArray = Split(line, ":")
regards
Hi,
Here it is; first you read the array, then you read line by line and after that you place it in the grid.
Dim myArray As Array
Hope it helps
Here it is; first you read the array, then you read line by line and after that you place it in the grid.
VB.NET Syntax (Toggle Plain Text)
myArray = Split(line, ":") Dim i As Integer dim val as For i = 0 To myArray.Length - 1 val = myArray(i) 'read the value of the items in the array dg.Item(row, column) = val 'place it in the datagrid Next
Hope it helps
![]() |
Similar Threads
- Cant readline in text file.... URGENT help~ (VB.NET)
- writing students data to a text file (Assembly)
- Read comma separated data from a text file (C)
- help me to read my data file:(( (C)
- conversion of text file into data base file (Visual Basic 4 / 5 / 6)
- Homework: filling array from text file (VB.NET)
- Inputting text file data into an array, please help! (C++)
- Read and write to an ASCII Text file (Java)
Other Threads in the VB.NET Forum
- Previous Thread: From InputBox to ListBox??
- Next Thread: syntax Error..
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account application arithmetic array basic beginner browser button buttons center check click code combo crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel listview module monitor net networking number open output panel passingparameters picturebox picturebox1 picturebox2 port print printing problem regex right-to-left searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey tcp temperature text textbox timespan toolbox transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






S1112:483720:E