191 lines
5.4 KiB
VB.net
191 lines
5.4 KiB
VB.net
Public Class MyMaskBox
|
|
Enum Inputtype
|
|
전부 = 1
|
|
숫자 = 2
|
|
문자 = 3
|
|
소문자 = 5
|
|
대문자 = 6
|
|
End Enum
|
|
|
|
Dim ColName As String
|
|
Dim Coltype As OleDbType = OleDbType.VarChar
|
|
Dim Ditem As Boolean
|
|
Dim Prompt As String
|
|
Dim WhereState As String = vbNullString
|
|
Dim NotNull As Boolean = False
|
|
Dim iNTYPE As Inputtype = Inputtype.전부
|
|
Dim DEF_VALUE As String = Me.Text
|
|
Protected Var_ViewColNumber As Short
|
|
Protected Var_BaseLabel As Label
|
|
|
|
<System.ComponentModel.Description("이 컨트롤과 연결된 문자를 나타낼 레이블을 선택합니다")> _
|
|
Public Property DB_BaseLabel() As Label
|
|
Get
|
|
Return Var_BaseLabel
|
|
End Get
|
|
Set(ByVal value As Label)
|
|
'//데이터가 들어오면 현재의 프롬프트를 갱신합니다.
|
|
Var_BaseLabel = value
|
|
Me.DB_Prompt = Prompt
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
<System.ComponentModel.Description("입력되는 값을 필터링합니다")> _
|
|
Public Property WHERE_DEFAULT_VALUE() As String
|
|
Get
|
|
Return DEF_VALUE
|
|
End Get
|
|
Set(ByVal value As String)
|
|
DEF_VALUE = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("입력되는 값을 필터링합니다")> _
|
|
Public Property Input_type() As Inputtype
|
|
Get
|
|
Return iNTYPE
|
|
End Get
|
|
Set(ByVal value As Inputtype)
|
|
iNTYPE = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("반드시입력되어야 할 값입니까?")> _
|
|
Public Property DB_NotNull() As Boolean
|
|
Get
|
|
Return NotNull
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
NotNull = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
<System.ComponentModel.Description("검색그룹에 있을시 WHere 절")> _
|
|
Public Property DB_WhereType() As String
|
|
Get
|
|
Return WhereState
|
|
End Get
|
|
Set(ByVal value As String)
|
|
WhereState = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("컬럼의 설명")> _
|
|
Public Property DB_Prompt() As String
|
|
Get
|
|
Return IIf(Prompt Is vbNullString, DB_ColName, Prompt)
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Prompt = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("바인딩될 데이터베이스 컬럼명")> _
|
|
Public Property DB_ColName() As String
|
|
Get
|
|
If ColName = "" Then
|
|
Return Me.Name
|
|
Else
|
|
Return ColName
|
|
End If
|
|
End Get
|
|
Set(ByVal value As String)
|
|
ColName = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("연결될 데이터베이스 데이터형식")> _
|
|
Public Property DB_Type() As OleDbType
|
|
Get
|
|
Return Coltype
|
|
End Get
|
|
Set(ByVal value As OleDbType)
|
|
Coltype = value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.Description("데이터베이스와 연결될 아이템인가?")> _
|
|
Public Property DB_ITEM() As Boolean
|
|
Get
|
|
Return Ditem
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
Ditem = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' 현재 값을 설정하거나 반환합니다.
|
|
''' </summary>
|
|
''' <value></value>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
<System.ComponentModel.Description("현재 값을 설정하거나 가져옵니다")> _
|
|
Public Property Value() As String
|
|
Get
|
|
Return Me.Text
|
|
End Get
|
|
Set(ByVal value As String)
|
|
If value.ToUpper = "$$DATE$$" Then
|
|
Me.Text = Format(Now, "yyyyMMdd")
|
|
Else
|
|
Me.Text = value
|
|
End If
|
|
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub MyMaskTextBox_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
Me.SelectAll()
|
|
End Sub
|
|
|
|
Private Sub TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
|
|
Select Case iNTYPE
|
|
Case Inputtype.대문자
|
|
If Char.IsNumber(e.KeyChar) Then
|
|
e.Handled = True
|
|
Else
|
|
e.KeyChar = Char.ToUpper(e.KeyChar.ToString)
|
|
End If
|
|
'If Not Char.IsUpper(e.KeyChar.ToString) Then e.Handled = True
|
|
Case Inputtype.문자
|
|
If Char.IsNumber(e.KeyChar) Then e.Handled = True
|
|
' If Not Char.IsLetter(e.KeyChar.ToString) Then e.Handled = True
|
|
|
|
Case Inputtype.소문자
|
|
If Char.IsNumber(e.KeyChar) Then
|
|
e.Handled = True
|
|
Else
|
|
e.KeyChar = Char.ToLower(e.KeyChar.ToString)
|
|
End If
|
|
'If Not Char.IsLower(e.KeyChar.ToString) Then e.Handled = True
|
|
Case Inputtype.숫자
|
|
|
|
If Char.IsLetter(e.KeyChar) Then e.Handled = True
|
|
End Select
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
|
|
If e.KeyCode = Keys.Enter Then SendKeys.Send("{TAB}")
|
|
If e.Alt AndAlso e.KeyCode = Keys.Enter Then SendKeys.Send("+{TAB}")
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
If Me.NotNull = True AndAlso Me.Text = "" Then
|
|
|
|
Me.ErrorProvider1.SetError(Me, "이 필드는 반드시 입력되어야합니다")
|
|
Else
|
|
Me.ErrorProvider1.Clear()
|
|
End If
|
|
End Sub
|
|
|
|
End Class
|