Solved

VB grid capabilities

Posted on 2004-04-20
3
680 Views
Last Modified: 2012-06-27
Hello,

I want to use a grid in VB6 that is capable of being bound to an ADO data source, and also is capable of hosting comboxes and other controls in the grid columns. Do the native Datagrid and Hierarchical FlexGrid in VB6 do this? As far as I can see, all the grids that come with VB are incapable of "hosting" other controls. Any comments or recommendations?

Thanks,
Trimtrom
0
Comment
Question by:trimtrom
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Shauli
Comment Utility
Datagrid has a built in "button", which can be defined for each cell. If you want a combobox effect you need to place a listbox below the cell. As per the FlexGrid. It does not have built in controls. However, what we do is, again, place textboxes or combobox on the given cell.

S
0
 
LVL 19

Accepted Solution

by:
Shauli earned 100 total points
Comment Utility
This would be an example how to place a combobox over  MSFlexGrid:

Locate MSFlexGrid & a combobox on your form, and copy this code:

'=============on form level
Private Sub Form_Load()
MSFlexGrid1.ScrollBars = flexScrollBarVertical
Combo1.Visible = False
End Sub

Private Sub Form_Resize()
MSFlexGrid1.Width = Me.ScaleWidth
MSFlexGrid1.Rows = 8
MSFlexGrid1.Height = Combo1.Height * 8
MSFlexGrid1.Left = 240
MSFlexGrid1.Top = 240
MSFlexGrid1.RowHeightMin = Combo1.Height
MSFlexGrid1.Cols = 5
Dim c
For c = 0 To 4
    MSFlexGrid1.ColWidth(c) = (Me.ScaleWidth - 240) / 5
Next c
End Sub

Private Sub MSFlexGrid1_LostFocus()
Combo1.Visible = False
End Sub

Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Combo1.Visible = False
        Combo1.Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft
        Combo1.Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop
        Combo1.Width = MSFlexGrid1.CellWidth
        Combo1.Visible = True
End Sub

S
0
 

Author Comment

by:trimtrom
Comment Utility
Hi,

That is certainly very interesting code you've got there.  I never thought this was possible.  I'll have to experiment!

Thanks,
Trimtrom
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 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

8 Experts available now in Live!

Get 1:1 Help Now