I create the following button and maskedtextbox dynamically, as well as other controls.
cntrl = New MaskedTextBox()
newControl(cntrl, "mtbSSN", "", "000-00-0000")
cntrl = New Button()
newControl(cntrl, "btnSearchSSN", "Search SSN)
Private Sub newControl(ByVal ControlType As Control, _
ByVal ControlName As String, _
ByVal ControlText As String, _
ByVal xLoc As Integer, _
Optional ByVal strMask As String = "")
Me.Controls.Add(ControlType)
With ControlType
.Name = ControlName
.Font = New System.Drawing.Font("Verdana", 9.0!)
.Size = New System.Drawing.Size(40, 20)
.AutoSize = True
End With
If TypeOf ControlType Is MaskedTextBox Then
ControlType.Mask = strMask]
ElseIf TypeOf ControlType Is Label Then
ControlType.Text = ControlText
ElseIf TypeOf ControlType Is Button Then
ControlType.Text = ControlText
ControlType.FlatStyle = FlatStyle.Flat
Getting these errors:
'Mask' is not a member of 'System.Windows.Forms.Control'
'Flatsyle' is not a member of 'System.Windows.Forms.Control'
when setting properties for maskedtextbox and button.
Any help will be greatly appreciated.
cntrl = New MaskedTextBox()
newControl(cntrl, "mtbSSN", "", "000-00-0000")
cntrl = New Button()
newControl(cntrl, "btnSearchSSN", "Search SSN)
Private Sub newControl(ByVal ControlType As Control, _
ByVal ControlName As String, _
ByVal ControlText As String, _
ByVal xLoc As Integer, _
Optional ByVal strMask As String = "")
Me.Controls.Add(ControlType)
With ControlType
.Name = ControlName
.Font = New System.Drawing.Font("Verdana", 9.0!)
.Size = New System.Drawing.Size(40, 20)
.AutoSize = True
End With
If TypeOf ControlType Is MaskedTextBox Then
ControlType.Mask = strMask]
ElseIf TypeOf ControlType Is Label Then
ControlType.Text = ControlText
ElseIf TypeOf ControlType Is Button Then
ControlType.Text = ControlText
ControlType.FlatStyle = FlatStyle.Flat
Getting these errors:
'Mask' is not a member of 'System.Windows.Forms.Control'
'Flatsyle' is not a member of 'System.Windows.Forms.Control'
when setting properties for maskedtextbox and button.
Any help will be greatly appreciated.