VERSION 5.00
Begin VB.UserControl ctlLabelAndTextBox 
   ClientHeight    =   3600
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4800
   ScaleHeight     =   3600
   ScaleWidth      =   4800
   Begin VB.TextBox txtTextBox 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   1315
      TabIndex        =   0
      Top             =   0
      Width           =   2895
   End
   Begin VB.Label lblLabel 
      AutoSize        =   -1  'True
      Caption         =   "Caption"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   225
      Left            =   0
      TabIndex        =   1
      Top             =   60
      Width           =   645
   End
End
Attribute VB_Name = "ctlLabelAndTextBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private msDataFormat As String
Public Event Change()
Public Event KeyPress(KeyAscii As Integer)

Private Sub txtTextBox_Change()

    RaiseEvent Change
    
End Sub

Private Sub txtTextBox_KeyPress(KeyAscii As Integer)

    RaiseEvent KeyPress(KeyAscii)

End Sub

Private Sub txtTextBox_LostFocus()
    
    On Error Resume Next
    If msDataFormat > "" Then
        txtTextBox = Format$(txtTextBox.Text, msDataFormat)
    End If
    
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    Text = PropBag.ReadProperty("Text", "")
    Midpoint = PropBag.ReadProperty("Midpoint", 1330)
    UserControl.Width = PropBag.ReadProperty("Width", 4800)
    Caption = PropBag.ReadProperty("Caption", "Caption")
    DataFormat = PropBag.ReadProperty("DataFormat", "")
    
    UserControl_Resize
    txtTextBox_LostFocus
    
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    PropBag.WriteProperty "Text", txtTextBox.Text
    PropBag.WriteProperty "Midpoint", Midpoint
    PropBag.WriteProperty "Width", UserControl.Width
    PropBag.WriteProperty "Caption", Caption
    PropBag.WriteProperty "DataFormat", msDataFormat
    
    UserControl_Resize
    txtTextBox_LostFocus
    
End Sub

Private Sub UserControl_Resize()

    Dim lLeft As Long
           
    UserControl.Height = txtTextBox.Height
    txtTextBox.Width = UserControl.Width - txtTextBox.Left
    
End Sub

Public Property Get Midpoint() As Long
    Midpoint = txtTextBox.Left
End Property

Public Property Let Midpoint(lTwips As Long)
    txtTextBox.Left = lTwips
    UserControl_Resize
End Property

Public Property Get TextWidth() As Long
    TextWidth = txtTextBox.Width
End Property

Public Property Let TextWidth(lTwips As Long)
    txtTextBox.Width = lTwips
End Property

Public Property Get Text() As String
    Text = txtTextBox.Text
End Property

Public Property Let Text(sText As String)
    
    If msDataFormat > "" Then
        txtTextBox.Text = Format$(sText, msDataFormat)
    Else
        txtTextBox.Text = sText
    End If
    
End Property

Public Property Get Caption() As String
    Caption = lblLabel.Caption
End Property

Public Property Let Caption(sText As String)
    lblLabel.Caption = sText
End Property

Public Property Get Enabled() As Boolean
    Enabled = txtTextBox.Enabled
End Property

Public Property Let Enabled(bEnabled As Boolean)
    txtTextBox.Enabled = bEnabled
    txtTextBox.BackColor = IIf(bEnabled, vbWhite, RGB(220, 220, 220))
End Property

Public Property Get DataFormat() As String
    DataFormat = msDataFormat
End Property

Public Property Let DataFormat(sValue As String)
    msDataFormat = sValue
End Property
