Solved

VB grid capabilities

Posted on 2004-04-20
3
686 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 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to incorporate an error traping routing to existing code in VB6 11 55
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 81
RUNRMTCMD from AS/400 13 130
VB6 Enviroment 3 37
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

738 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