Solved

Populate an UNBOUND DBGrid from a recordset

Posted on 2000-03-14
5
450 Views
Last Modified: 2013-12-25
I am using VB5 with SP3. I am trying to populate an UNBOUND DBGrid (5 columns) from a recordset. I do not want to use a bound DBGrid. I cannot understand the on-line help particularly the section on the RowBuffer.

Can someone set out the code in simple terms to populate the grid. It will usually be 5 or 6 rows.
0
Comment
Question by:PeterN
5 Comments
 
LVL 15

Expert Comment

by:ameba
ID: 2617895
This is many, many KB of code. The code is ugly and DBGrid control is also ugly.
0
 
LVL 15

Expert Comment

by:ameba
ID: 2617904
What is the record count of your recordset?
0
 

Expert Comment

by:amuru
ID: 2618316
i'm using VB6 currently.  I think to populate unbound data to grid display, it is easier if use MSFlxGrd/MSHFlxGrd control. Below is simple setting that might be useful for u, connected to access database.


Dim lPcode As String
lPcode = txtName.Text
dtaDetail.RecordSource = "Select RSLT_6COPY, RSLT_PCODE, RSLT_PNAME, RSLT_SUPCD, RSLT_DDATE, RSLT_IDATE from InspectResult where RSLT_PCODE = '" & lPcode & "'"
dtaDetail.Refresh

0
 
LVL 1

Accepted Solution

by:
tkuppinen earned 100 total points
ID: 2619832
Use the flex grid.  Much easier than the DBgrid.

then to add the records from a created recordset all you have to do is loop through

While Not rsNontrol.EOF
        msNontrol.AddItem (rsNontrol("Name") & vbTab & rsNontrol("Position") & vbTab & rsNontrol("SEX") & vbTab & _
        rsNontrol("Race") & vbTab & rsNontrol("education") & vbTab & rsNontrol("remarks"))
        msNontrol.RowData(msNontrol.Row) = CLng(rsNontrol("id"))
        rsNontrol.MoveNext
    Wend
0
 

Author Comment

by:PeterN
ID: 2625299
Was hoping to use the DBGrid but it seems that everyone agrees the MSFlexGrid is better. Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question