VB6 Dataset Equivalent (1 Viewer)

Tanner65

Registered User.
Local time
Today, 01:54
Joined
Aug 31, 2007
Messages
66
Hey there guys, I've created an installer program in .Net 2.0 before finding out that the units to be installed wont have .Net on them yet, so I'm having to re-work it all in VB6.

Well my question is about datasets and/or recordsets. In .Net I could get the value from a column/row by

Code:
Dim cr As String = datatable.Rows(R).Item(C).ToString()
That's flipping easy for me to do a loop based upon the file.

But with VB6, how would I get the equivalent?

I'm using csv files with 3 fields: an Index field of single digits for demoing purposes (possibly up to 4 digits) - equivalent to the row (Column titled "Index"); a application display name similar to "Microsoft Excel" (Column titled "DisplayName"); and a path field which would show full path to the msi similar to "f:\Microsoft\Microsoft Excel.msi" (Column title "Path").

My ultimate goal in the VB6 version is similar to the functionality of the .net version. Dynamically create and name the controls based on the index
in the csv file ("ckbox" & row#), put the display name as the caption/text of the control, and after the user decides what needs to be pressed go directly to that row and return the path to the file selected. I've got the controls to create and be removed down fine, and using .movenext to apply the caption/text to the controls. But need a way to quickly go to a row and field.

Any ideas will be fantastic! Thanks for all of your help!

FYI: I'm used to using ADO and am currently using this to read the file, but I'm open to other ideas as well.
 

doco

Power User
Local time
Yesterday, 23:54
Joined
Feb 14, 2007
Messages
482
Are you trying to loop through the fields of records of an ADO recordset?
The recordset is named 'datatable'?
There are three fields to a record: 'Index', 'DisplayName', 'Path'?
The results populated to a String variable?

Code:
...
    Dim cr As String
 
    '    code establishing connection and looping
        '    or whatever fieldname or the index of the field ( 0 to 2 ) 
                cr = CStr( datatable.Fields("Index") )
 
Last edited:

Tanner65

Registered User.
Local time
Today, 01:54
Joined
Aug 31, 2007
Messages
66
No, the code I provided was for .Net 2.0 where I removed the variable names (except for R for row and C for column/field) and put in the variable type.

My whole goal is to avoid the move next statement whichever way is possible. I like the datatable functionality in .Net because I can say "In this field goto this row" or "In this row go to this field."

Essentially my whole goal was to find a way to avoid the .MoveNext and .MovePrevious methods over and over. But after lots of research, I've gone with a different route of opening the recordset and closing it with each loop. Since it's only connected to a text file and I only need the data from the one line.
 

doco

Power User
Local time
Yesterday, 23:54
Joined
Feb 14, 2007
Messages
482
I do not have a lot of experience with reading text files but it seems to me unless you 'read' the file into some kind of data container that parses the comma delimits you will need to do this using the Line# attribute ( R ) and then build your own parser for C ( column ).

Have you looked at the .AbsolutePosition method of the RecordSet object?
 

Tanner65

Registered User.
Local time
Today, 01:54
Joined
Aug 31, 2007
Messages
66
Actually, I think .AbsolutePosition would work perfectly for me. I was hoping to have a single line, but two lines'll do.

I am still unfamiliar with it, but from what it does, I think it'll work perfectly for me!

Thanks for your help!
 

Users who are viewing this thread

Top Bottom