473,396 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading .dat file (input) into MSFlexGrid

63
Hey. How can I input data into an MSFlexGrid table from a .dat file ?

I have the following data in the data file:

"Mike", "20", "Boston"

I would like to read "Mike" in row 1, column 1
read "20" in row 1, column 2
and "Boston" in row 1, column 3

Please Help

Thanks in advance ;)
Feb 7 '08 #1
2 1967
VBWheaties
145 100+
Hey. How can I input data into an MSFlexGrid table from a .dat file ?

I have the following data in the data file:

"Mike", "20", "Boston"

I would like to read "Mike" in row 1, column 1
read "20" in row 1, column 2
and "Boston" in row 1, column 3

Please Help

Thanks in advance ;)
Open the file, loop through its contents, parse out the values and set them to the grid using TextMatrix.
if you want something more sophisticated, use the Text driver to open your dat file as a datasource.
That way, you can bind a recordset to the grid. However,you are at the mercy of the underlying provider who has a bad habit of changing certain data (like string columns to numbers if the first few rows have numeric values).

Suggestion: if the file is relatively small, read it in using a loop.
Feb 7 '08 #2
Killer42
8,435 Expert 8TB
I concur with VBWheaties. However, you need to take care.

For one thing, CSV format allows for the field delimiters (and string delimiters such as ") to appear within the data. For instance, let's say we had this record...
"Mike", "20", "Boston, Mass"
If imported into Excel, this would produce three items:
  • Mike
  • 20
  • Boston, Mass
If you read this same record into a string and use the Split() function to chop it into fields, it doesn't know anything about fields or delimiters, except the one you tell it to watch for (comma, in this case). So you would end up with four items...
  • Mike
  • 20
  • Boston
  • Mass
Feb 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: SB | last post by:
Hello. I have an input file which is laid out in the following manner... Name Day 1 am time 1 am time 2 appointment pm time 1 pm time 2 appointment Day 2
0
by: Ed | last post by:
Hi, I am using an MSflexgrid in my c# code. I have a strange problem. My MSflexgrid has only 1 column. Now the data in that column can be long. WIth just 1 column the MSflexgrid does not show...
0
by: Martin K | last post by:
Hello all..thanks for everyone's advice regarding my SHBrowseForFolder API problem, I was able to put together a public class that runs great! But I have another migration headache regarding the...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
1
by: zoneal | last post by:
Hi, I am involved in the process of migrating vb(6.0) application to vb.net. My application contains only vb controls namely MSFLEXGRID. I want to migrate my application to vb.net completely...
1
by: Steven | last post by:
I develop the application which contains MSFlexGrid to display data. When I try to fill the grid with the text data, I want to adjust the column width so that the width is adjusted to the maximum...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
1
by: MiziaQ | last post by:
The following code loads a sequential .txt file into an msflexgrid once a the second is clicked. The code for adding is correct. However it loads the file twice for some reason ? How do make it to...
4
by: MiziaQ | last post by:
Hey, I'm using the following code to write entries to a data file and then read them in an msflexgrid. I now would like to add code under a delete button to use the table(grid) to delete rows from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.