|
-
Oct 10th, 2001, 11:57 PM
#1
Thread Starter
Lively Member
Referencing a control?
I'd like to run 3 specific MSHFlexGrids through a for/next loop, but i don't know how to reference them correctly. Below is an example of what I am trying to do:
Code:
Dim cControl as MSHFlexGrid
For i = 1 To 3
If i = 1 Then
cControl = Me.flxFindPhones
ElseIf i = 2 Then
cControl = Me.flxViewPhones
ElseIf i = 3 Then
cControl = Me.flxEditPhones
End If
With cControl
.TextMatrix(0, 0) = "Type"
.TextMatrix(0, 1) = "Number"
.Row = 0
For j = 0 To 1
.Col = j
.CellAlignment = flexAlignLeftCenter
Next j
.ColWidth(0) = 1920
.ColAlignment(0) = flexAlignLeftCenter
.ColWidth(1) = 2835
.ColAlignment(1) = flexAlignLeftCenter
End With
Next i
The code above chokes on "cControl = Me.flxFindPhones". Any other ideas out there?
Thanks,
Jeff
-
Oct 11th, 2001, 01:19 AM
#2
Since you are dealing with references you need to use the keyword set. Like this:
Code:
Dim cControl as MSHFlexGrid
For i = 1 To 3
If i = 1 Then
Set cControl = Me.flxFindPhones
ElseIf i = 2 Then
Set cControl = Me.flxViewPhones
ElseIf i = 3 Then
Set cControl = Me.flxEditPhones
End If
With cControl
.TextMatrix(0, 0) = "Type"
.TextMatrix(0, 1) = "Number"
.Row = 0
For j = 0 To 1
.Col = j
.CellAlignment = flexAlignLeftCenter
Next j
.ColWidth(0) = 1920
.ColAlignment(0) = flexAlignLeftCenter
.ColWidth(1) = 2835
.ColAlignment(1) = flexAlignLeftCenter
End With
Next i
-
Oct 11th, 2001, 01:37 AM
#3
Thread Starter
Lively Member
That's exactly the ticket AIS_DK!
Thanks a bunch.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|