自定义控件type
大家好,我做了个控件,正常的可以使用,
只是在用
for each ctl in vControls
if typeof ctl is textbox then
endif
next
運行時的type類型屬於textbox,我真是不明白了,上網查也沒有查到,請大家幫個忙了,怎樣改變自定義控件的type,謝謝了
下面是我的自定義控件代碼
Public Class ucNaturalNumericBox
Public Property InputOut()
Get
Return txtInput.Text.Trim
End Get
Set(ByVal Value)
txtInput.Text = Value
End Set
End Property
Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
If Asc(e.KeyChar) <> Keys.Back And txtInput.Text.Trim.Length = 0 And Asc(e.KeyChar) = Keys.Insert Then
e.Handled = False
ElseIf Asc(e.KeyChar) <> Keys.Back And txtInput.Text = Chr(Keys.D0) Then
e.Handled = True
ElseIf Asc(e.KeyChar) <> Keys.Back And txtInput.Text.Trim = Chr(Keys.Insert) And Asc(e.KeyChar) = Keys.D0 Then
e.Handled = True
ElseIf Asc(e.KeyChar) <> Keys.Back And IsNumeric(e.KeyChar) = False Then
e.Handled = True
End If
End Sub
End Class