Formating Data

equis
01-12-2004, 04:13 AM
Hello,

I am making a program that gets data from an internet server, I've done that bit, now I need format it so I can enter it into database.

this is the data I get: (except in VB it is all one line with small | sort of spacers in them (I think its the newline character but Im not sure)

How would I enter this into a database as 23 rows (not just one) and also split into 4 fields?

Thanks Heaps

1 0.00 0.00 0.00
2 0.00 0.00 0.00
3 0.00 0.00 0.00
4 0.00 0.00 0.00
5 0.00 0.00 0.00
6 0.00 0.00 0.00
7 0.00 0.00 0.00
8 0.00 0.00 0.00
9 0.00 0.00 0.00
10 0.00 0.00 0.00
11 0.00 0.00 0.00
12 0.00 0.00 0.00
13 0.00 0.00 0.00
14 0.00 0.00 0.00
15 0.00 0.00 0.00
16 0.00 0.00 0.00
17 14.58 0.02 0.00
18 163.64 0.08 0.00
19 197.32 0.12 0.00
20 180.27 0.00 0.00
21 139.43 0.02 0.00
22 0.00 0.00 0.00
23 0.00 0.00 0.00

samr
01-12-2004, 04:23 AM
If you use a flex grid to display the data, then the following will work (the data is storred in text1, can be converted to a string):
Dim txtarr() As String
Dim i As Integer
MSFlexGrid1.rows = 0
MSFlexGrid1.cols = 4
txtarr = Split(Replace$(Text1.Text, " ", vbTab), vbCrLf)
For i = LBound(txtarr) To UBound(txtarr)
MSFlexGrid1.AddItem txtarr(i)
Next

equis
01-12-2004, 04:35 AM
Thanks for that.

When I do the I get 1 line in the Grid

"1 0.00 0.00 0.00|2"

:-)

waits77
01-12-2004, 05:46 AM
in the code provided by samr, try changing the Split character from vbCrLf to Chr(10) which is a line feed. vbLineFeed may work as well.
txtarr = Split(Replace$(Text1.Text, " ", vbTab), Chr(10))

equis
01-13-2004, 09:40 PM
It Worked!

Thank you both :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum