Solved

Populate Flexigrid

Posted on 2001-06-29
2
360 Views
Last Modified: 2008-02-01
I need to link a flexigrid to a datasource. has anyone got example code on how to do this?
0
Comment
Question by:krisjob
2 Comments
 
LVL 20

Expert Comment

by:hes
ID: 6239547
0
 
LVL 1

Accepted Solution

by:
edwinson earned 100 total points
ID: 6239560
Let's assume for the moment you have an ADO recordset. The included code gives you an example of how to connect a MSHflexgrid to an ADO recordset.
 
'First I set the fixed columns on my grid so the new
'data initially won't have a column of grayed out data
flxPerfTable.FixedCols = 0

'flxPerfTable - name of the MSHflexgrid
'rstPerf      - name of an ADO recordset containing
'               the desired data.
'
'next I use the set function of the flexgrid to assign
'a clone of a recordset to the grid. This loads the grid
'with the data.
'Basically you create a copy of the reference
'to the recordset.
Set flxPerfTable.DataSource = rstPerf.Clone

'Alternatively you can sometimes use
set flxPerfTable.DataSource = rstPerf

'In my code I have a column of record ID numbers that I
'want to be shaded gray so I reset the fixed columns to 1
flxPerfTable.FixedCols = 1


While this may get the data displayed in the grid you may want to do some additional formatting of column widths etc. to make sure the data can be viewed by your users in a way that makes sense.  Watch for data formatting as the flexgrid primarily handles text, so some data looks goofy when shown in the grid. In these cases you may need to modify the formatting of the data in the ADO prior to display. Experiment a bit.

Now if you haven't created an ADO recordset yet, you will need to do this as well before running the code above.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now