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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a MSFlexGrid in a Procedure

Status
Not open for further replies.

Maheshkshirsagar

Programmer
Nov 5, 2000
11
0
0
GB
Hi..

I have 2 FlexGrids on a form namely msflexgrid1 and msflexgrid2.

I have a procedure which requires msflexgrid as parameter
which is given below

Public Sub FlexClick(abc As MSFlexGrid)
Text1.Visible = True
Text1.Height = 255
Text1.Left = abc.CellLeft + 150
Text1.Top = abc.CellTop + 850
Text1.Height = abc.CellHeight
Text1.Width = abc.CellWidth
Text1.Height = 255
Text1.SetFocus
End Sub

I am calling this procedure on Click event of both the grids.
like

Private Sub MSFlexGrid1_Click()
FlexClick MSFlexGrid1
End Sub

Private Sub MSFlexGrid2_Click()
FlexClick MSFlexGrid2
End Sub

But...It doesnt works..

After debuggimg i find that variable 'abc' in procedure is no getting value of either 'msflexgrid1' or 'msflexgrid2'.

Whats the problem??

Thanks in advance
Mahesh Kshirsagar

 
The controls are getting passed through as parameters (to test this put grid1 and grid2 to as the controls Tag property values and then use the watch window to view the tag values). The problem with the code is the calculation you are using to move the text box. The CellTop and CellLeft values are the internal gid values and not the form values, so for the one clickable row in you test grids the value is always the same. If you increase the number of rows to create more clickable cell values you will see the text box moving as desired. To get the correct text box position try:

Text1.Left = abc.CellLeft abc.left
Text1.Top = abc.CellTop + abc.top

Incidentally you may want to pass the text box as a parameter so that you can later change your code to allow you to pass in another control (such as a Combo Box).

Regards

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top