Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Formating Data


Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2004, 04:13 AM
equis equis is offline
Regular
 
Join Date: Nov 2002
Posts: 89
Default Formating Data


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
Reply With Quote
  #2  
Old 01-12-2004, 04:23 AM
samr samr is offline
Senior Contributor
 
Join Date: Jul 2003
Location: London, England
Posts: 993
Default

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):
Code:
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
Reply With Quote
  #3  
Old 01-12-2004, 04:35 AM
equis equis is offline
Regular
 
Join Date: Nov 2002
Posts: 89
Default

Thanks for that.

When I do the I get 1 line in the Grid

"1 0.00 0.00 0.00|2"

:-)
Reply With Quote
  #4  
Old 01-12-2004, 05:46 AM
waits77 waits77 is offline
Senior Contributor
 
Join Date: May 2003
Posts: 805
Default

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.
Code:
txtarr = Split(Replace$(Text1.Text, " ", vbTab), Chr(10))
Reply With Quote
  #5  
Old 01-13-2004, 09:40 PM
equis equis is offline
Regular
 
Join Date: Nov 2002
Posts: 89
Default

It Worked!

Thank you both
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - Newbie - Huge problem - should be easy for you eastcore Excel 5 02-09-2004 09:36 PM
Formating columns of data to printer littlerockz Word, PowerPoint, Outlook, and Other Office Products 0 08-26-2003 12:05 AM
formating data passed from an Access DB Rutibaker Database and Reporting 8 08-05-2003 10:40 AM
programming for IRC with VB tutorial crazycheetah Tutors' Corner 0 05-04-2003 05:15 PM
Suggestions/Ideas on formating data linzy General 8 10-31-2001 02:16 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->