The Microsoft Visual Basic for Applications FlexGrid (MSFlexGrid) control allows you to add and display text and images in the Windows Forms cells. It also includes the functions that give users the ability to sort, merge and format tables containing character strings and numerical data types. The FlexGrid control uses form initialisation and database connection procedures for populating user forms with data. You simply need to specify the location of cells on user forms in order to fill a FlexGrid control with data.
- Skill level:
- Moderately Easy
Other People Are Reading
Click the "Start" button in Windows, and then select "Microsoft Visual Studio."
Click "Open." Locate and select the C++ program in which you want to fill a FlexGrid control with data in the "Open File" dialogue box.
Type the following code in the declarations section of the UserForm:
Public oDataBase As Database
Public oWorkSpace As Workspace
Public oRecordSet As Recordset
Public strDB As String
Public strDBTable As String
Dim strDBField() As String ' Array for Database field names.
Private Sub UserForm_Initialize()
strDB = Options.DefaultFilePath(wdProgramPath) & _ "\Samples\Northwind.mdb" ' Database Table To Use. strDBTable = "Customers" ' Database Field(s) To Use. ReDim strDBField(2) strDBField(0) = "CompanyName" strDBField(1) = "ContactName" strDBField(2) = "ContactTitle" DBConnect PopulateGridControl
Set oWorkSpace = CreateWorkspace(Name:="JetWorkspace", _ UserName:="admin", Password:="", UseType:=dbUseJet) Set oDataBase = OpenDatabase(strDB) Set oRecordSet = oDataBase.OpenRecordset(strDBTable)
Click "File" followed by "Save" to fill a FlexGrid control with data in your C++ program.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for