Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB grid capabilities

Posted on 2004-04-20
3
Medium Priority
?
690 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
[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
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Shauli
ID: 10871941
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 400 total points
ID: 10872175
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
ID: 10872362
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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.
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…
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…
Suggested Courses

722 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