Code:
Public Class Reporting
Inherits Label
Public Event ValueChanged As EventHandler
#Region "Basic Properties"
Private SavedBackColor As System.Drawing.Color
'* Remove Text from the property window so users do not attempt to use it
<System.ComponentModel.Browsable(False)> _
Public Overrides Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
End Set
End Property
'******************************************************************************************
'* Use the base control's text property and make it visible as a property on the designer
'******************************************************************************************
Private m_Value As String
Public Property Value As String
Get
Return m_Value
End Get
Set(ByVal value As String)
If value <> m_Value Then
If value IsNot Nothing Then
m_Value = value
UpdateText()
Else
m_Value = ""
MyBase.Text = ""
End If
'* Be sure error handler doesn't revert back to an incorrect text
OriginalText = MyBase.Text
OnvalueChanged(EventArgs.Empty)
End If
End Set
End Property
Private m_ValueLeftPadCharacter As Char
Public Property ValueLeftPadCharacter() As Char
Get
Return m_ValueLeftPadCharacter
End Get
Set(ByVal value As Char)
m_ValueLeftPadCharacter = value
UpdateText()
Invalidate()
End Set
End Property
Private m_ValueLeftPadLength As Integer
Public Property ValueLeftPadLength As Integer
Get
Return m_ValueLeftPadLength
End Get
Set(ByVal value As Integer)
m_ValueLeftPadLength = value
UpdateText()
Invalidate()
End Set
End Property
'**********************************
'* Prefix and suffixes to text
'**********************************
Private m_Prefix As String
Public Property ValuePrefix() As String
Get
Return m_Prefix
End Get
Set(ByVal value As String)
m_Prefix = value
UpdateText()
Invalidate()
End Set
End Property
Private m_Suffix As String
Public Property ValueSuffix() As String
Get
Return m_Suffix
End Get
Set(ByVal value As String)
m_Suffix = value
UpdateText()
Invalidate()
End Set
End Property
'***************************************************************
'* Property - Highlight Color
'***************************************************************
Private _Highlightcolor As Drawing.Color = Drawing.Color.Red
<System.ComponentModel.Category("Appearance")> _
Public Property HighlightColor() As Drawing.Color
Get
Return _Highlightcolor
End Get
Set(ByVal value As Drawing.Color)
_Highlightcolor = value
End Set
End Property
Private _HighlightKeyChar As String = "!"
<System.ComponentModel.Category("Appearance")> _
Public Property HighlightKeyCharacter() As String
Get
Return _HighlightKeyChar
End Get
Set(ByVal value As String)
_HighlightKeyChar = value
End Set
End Property
Private m_Format As String
Public Property NumericFormat() As String
Get
Return m_Format
End Get
Set(ByVal value As String)
m_Format = value
End Set
End Property
Private m_ValueScaleFactor As Double = 1
Public Property ValueScaleFactor() As Double
Get
Return m_ValueScaleFactor
End Get
Set(ByVal value As Double)
m_ValueScaleFactor = value
'TODO: Does not refresh in designmode
'Text = MyBase.Text
End Set
End Property
Public Enum BooleanDisplayOption
TrueFalse
YesNo
OnOff
End Enum
Private m_BooleanDisplay As BooleanDisplayOption
Public Property BooleanDisplay() As BooleanDisplayOption
Get
Return m_BooleanDisplay
End Get
Set(ByVal value As BooleanDisplayOption)
m_BooleanDisplay = value
End Set
End Property
#End Region
#Region "date_Properties"
Private _thnk_set_1 As BasicTextBox
Private _thnk_set_2 As TextBox
Private _thnk_set_3 As TextBox
Private _thnk_set_4 As TextBox
Private _thnk_set_5 As TextBox
Private _thnk_set_6 As TextBox
Private _thnk_set_7 As TextBox
Private _BatchName As Label
Private _Works As Label
Private _Dates As DateTimePicker
Private _Time As DateTimePicker
Private _BatchID As Integer
Public Property BatchName() As Label
Get
Return _BatchName
End Get
Set(ByVal value As Label)
_BatchName = value
End Set
End Property
Public Property thnk_set_1() As BasicTextBox
Get
Return _thnk_set_1
End Get
Set(ByVal value As BasicTextBox)
_thnk_set_1 = value
End Set
End Property
Public Property thnk_set_2 As TextBox
Get
Return _thnk_set_2
End Get
Set(ByVal value As TextBox)
_thnk_set_2 = value
End Set
End Property
Public Property thnk_set_3 As TextBox
Get
Return _thnk_set_3
End Get
Set(ByVal value As TextBox)
_thnk_set_3 = value
End Set
End Property
Public Property thnk_set_4 As TextBox
Get
Return _thnk_set_4
End Get
Set(ByVal value As TextBox)
_thnk_set_4 = value
End Set
End Property
Public Property thnk_set_5 As TextBox
Get
Return _thnk_set_5
End Get
Set(ByVal value As TextBox)
_thnk_set_5 = value
End Set
End Property
Public Property thnk_set_6 As TextBox
Get
Return _thnk_set_6
End Get
Set(ByVal value As TextBox)
_thnk_set_6 = value
End Set
End Property
Public Property thnk_set_7 As TextBox
Get
Return _thnk_set_7
End Get
Set(ByVal value As TextBox)
_thnk_set_7 = value
End Set
End Property
Public Property Works As Label
Get
Return _Works
End Get
Set(ByVal value As Label)
_Works = value
End Set
End Property
Public Property Dates As DateTimePicker
Get
Return _Dates
End Get
Set(ByVal value As DateTimePicker)
_Dates = value
End Set
End Property
Public Property Time As DateTimePicker
Get
Return _Time
End Get
Set(ByVal value As DateTimePicker)
_Time = value
End Set
End Property
Public Sub sh()
MessageBox.Show(_thnk_set_2.Text)
End Sub
#End Region
#Region "insert_DateBase"
Public Sub insert_DateBase()
Dim x As Integer
Dim dt As DataTable = db.GetRecors("select * from BatchFinal")
x = dt.Rows.Count + 1
db.InsertBatchFinal(x, CStr(_BatchName.Text), CDbl(_thnk_set_1.Text), CDbl(_thnk_set_2.Text), CDbl(_thnk_set_3.Text), CDbl(_thnk_set_4.Text), CDbl(_thnk_set_5.Text), CDbl(_thnk_set_6.Text), CDbl(_thnk_set_7.Text), CStr(_Works.Text), Format(_Dates.Value, "yyyy/MM/dd"), CStr(_Time.Value))
End Sub
#End Region
This code tool Label from your own library with the amendment when the value is enabled to be preserved