Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a Commandbutton on a specific grid cell

Status
Not open for further replies.

meltdown

Programmer
May 1, 2002
7
0
0
CA

I'm trying to get a grid of command buttons.

Basically I need to have a 3 by 3 grid where the each cell is actually a commandbutton as opposed to a text box. Can this be done.

I am trying to use the MS Flex Grid but if there is another way I would be happy to hear it.

thanks
 
Why not just make a control array of 9 command buttons? Anything is possible, the problem is I only have one lifetime.
[cheers]
 
I agree with foada, build a button array and position them to give the appearance of a grid.

Remember that the cells of a flexgrid are simply placeholders for text. However, you can simulate them acting as buttons with the following code in the Click Event of the Grid.

Private Sub grdGrid_Click()

Dim lInt_SelRow As Integer
Dim lInt_SelCol As Integer

lInt_SelRow = grdGrid.Row
lInt_SelCol = grdGrid.Col

Select Case lInt_SelRow
Case 0
Select Case lInt_SelCol
Case 0
ExecFunctionFromCell00
Case 1
ExecFunctionFromCell01
Case 2
ExecFunctionFromCell02
End Select
Case 1
Select Case lInt_SelCol
Case 0
ExecFunctionFromCell10
Case 1
ExecFunctionFromCell11
Case 2
ExecFunctionFromCell12
End Select
Case 2
Select Case lInt_SelCol
Case 0
ExecFunctionFromCell20
Case 1
ExecFunctionFromCell21
Case 2
ExecFunctionFromCell22
End Select
End Select

End Sub

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top