?
Solved

Populate an UNBOUND DBGrid from a recordset

Posted on 2000-03-14
5
Medium Priority
?
456 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 300 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 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