Hi List,
in my quest of understanding RB I fabricated this method in an action
event of a bevelbutton
[CODE]
Dim arControl() As Control
if App.TheCoach.NewAssignment() then
arControl.Append(pp_p0_title)
arControl.Append(lbl_AssName)
arControl.Append(fld_assign_name)
arControl.Append(gb_coachdata)
arControl.Append(lbl_CoachName)
arControl.Append(lbl_CoachEmail)
arControl.Append(fld_CoachFullName)
arControl.Append(fld_Coachemail)
GroupEnableControls(arControl,True)
fld_assign_name.SetFocus()
end if
[/CODE]
The GroupEnableControl method looks like this:
[CODE]
Sub GroupEnableControls(aControl() As control,State As Boolean)
Dim i As Integer
Dim ThisControl As Control
For i = 0 to UBound(aControl)
ThisControl = aControl(i)
Select Case True
case ThisControl IsA StaticText
StaticText(ThisControl).Enabled = State
case ThisControl IsA EditField
EditField(ThisControl).Enabled = State
Case ThisControl Isa GroupBox
GroupBox(ThisControl).Enabled = State
Case ThisControl IsA PushButton
PushButton(ThisControl).Enabled = State
Case ThisControl IsA BevelButton
BevelButton(ThisControl).Enabled = State
Case ThisControl IsA Listbox
Listbox(ThisControl).Enabled = State
Case ThisControl IsA CheckBox
CheckBox(ThisControl).Enabled = State
Case ThisControl IsA PopupMenu
PopupMenu(ThisControl).Enabled = State
else
MsgBox "Unidentified ControlType in method"
end Select
Next
End Sub
[/CODE]
This is working OK
However when I try this in the calling method:
[CODE]
Dim arControl() As Control
if App.TheCoach.NewAssignment() then
arControl =Array
(lbl_AssName,fld_assign_name,lbl_CoachName,lbl_CoachEmail,fld_CoachFullN
ame,fld_Coachemail)
GroupEnableControls(arControl,True)
fld_assign_name.SetFocus()
end if
[/CODE]
This is NOT accepted by the compiler.
The compiler states : expected Control but got Variant (not literally)
Is there someone who can explain me why the first version is
acceptable and the second is not ?
TIA
Bart Pietercil
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>