欢迎光临
我们一直在努力

vb经验谈:限制输入的文本框_visualbasic教程

建站超值云服务器,限时71元/月

PublicClassMyTextBox
  InheritsSystem.Windows.Forms.TextBox
  Privatem_strValidTextAsString=”0123456789. -“&Chr(13).ToString
  Privatem_blnEditableAsBoolean=True
  #Region”Windows窗体设计器生成的代码”
  PublicSubNew()
  MyBase.New()
  该调用是Windows窗体设计器所必需的。
  InitializeComponent()
  在InitializeComponent()调用之后添加任何初始化
  EndSub
  UserControl1重写dispose以清理组件列表。
  ProtectedOverloadsOverridesSubDispose(ByValdisposingAsBoolean)
  IfdisposingThen
  IfNot(componentsIsNothing)Then
  components.Dispose()
  EndIf
  EndIf
  MyBase.Dispose(disposing)
  EndSub
  Windows窗体设计器所必需的
  PrivatecomponentsAsSystem.ComponentModel.IContainer
  注意:以下过程是Windows窗体设计器所必需的
  可以使用Windows窗体设计器修改此过程。
  不要使用代码编辑器修改它。
  PrivateSubInitializeComponent()
  components=NewSystem.ComponentModel.Container
  EndSub
  #EndRegion
  PrivateSubMyTextBox_KeyPress(ByValsenderAsObject,ByValeAsSystem.Windows.Forms.KeyPressEventArgs)HandlesMyBase.KeyPress
  DimstrLocalStringAsString
  IfEditAbleThen
  strLocalString=m_strValidText&Chr(8).ToString
  Else
  strLocalString=m_strValidText
  EndIf
  IfUCase(strLocalString).IndexOf(UCase(e.KeyChar))<0Then
  e.Handled=True
  Beep()
  Else
  EndIf
  EndSub
  PublicPropertyValidText()AsString
  Get
  Returnm_strValidText
  EndGet
  Set(ByValValueAsString)
  m_strValidText=Value
  EndSet
  EndProperty
  PublicPropertyEditAble()AsBoolean
  Get
  Returnm_blnEditable
  EndGet
  Set(ByValValueAsBoolean)
  m_blnEditable=Value
  EndSet
  EndProperty
  EndClass->

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » vb经验谈:限制输入的文本框_visualbasic教程
分享到: 更多 (0)