Avatar of alvarso
alvarso

asked on 

vb6 code-only recordset/datagrid

Hi,
I hope this is a reasonably quick/easy question, and apologize for not having the patience to find the answer (which likely exists out there).

I want a SIMPLE way to show a table in Visual Basic 6 and fill it with data programmatically. I do NOT want to have to create a database file, etc.

In a quick sample code I would like:
  dim data as recordset ' or whatever type I need

  data.field.add("Column 1", string)
  data.field.add("Column 2", string)

  ' add my data from other places in my program
  for i=1 to totalRows
    data.addRow(myData(1,i), myData(2,i)
  next

  ' then, with a 'datagrid' control I add in design time
  set datagrid.datasource = data

and expec that this will show the data in the grid.  As much as I've tried, I can't find a way to "open" a recordset which does not require me to open an existing file and connect to a database engine.

(Really, what I want to do, is to easily display a two dimensional array in a quick graphical way, ideally I could just say
  datagrid1.data = arrayNbyM
and show it)

Thank you!


Visual Basic Classic

Avatar of undefined
Last Comment
alvarso
ASKER CERTIFIED SOLUTION
Avatar of ema20
ema20
Flag of Philippines image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of alvarso
alvarso

ASKER

Thanks a lot!  Sorry I was so tired of dealing with over-complex 'help' files that I had to ask for this reasonably pre-solved answer.  It worked beautifully (if only they could tell you in the help file that to open a recordset "locally" you can use no arguments in the open command!)
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo