| | |
how to read data from text file into data grid???
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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 |
"crystal .net .net2005 30minutes 2008 access add application arithmetic array assignment basic binary box button buttons center click code combo combobox component connectionstring convert cpu data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees excel exists firewall folder image images isnumericfuntioncall login math memory mobile module ms msaccess mssqlbackend mysql navigate net opacity pan peertopeervideostreaming picturebox picturebox1 port print printpreview problemwithinstallation project record regex reports" reuse right-to-left save savedialog search serial sorting sqldatbase storedprocedure string temp textbox timer txttoxmlconverter updown useraccounts usercontol usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vbnet view vista visual visualbasic visualbasic.net visualstudio web wpf xml






S1112:483720:E