diff --git a/Global_Indexer/ClassControls.vb b/Global_Indexer/ClassControls.vb index a14a36e..d86b8fc 100644 --- a/Global_Indexer/ClassControls.vb +++ b/Global_Indexer/ClassControls.vb @@ -2,6 +2,7 @@ Imports Oracle.ManagedDataAccess.Client Imports DigitalData.Controls.LookupGrid + Public Class ClassControls Private Property Form As frmIndex Private Property Panel As Panel @@ -49,7 +50,7 @@ Public Class ClassControls Return chk Catch ex As Exception LOGGER.Info("Unhandled Exception in AddCheckBox: " & ex.Message) - LOGGER.Error(ex.message) + LOGGER.Error(ex.Message) Return Nothing End Try End Function @@ -112,7 +113,7 @@ Public Class ClassControls Return oControl Catch ex As Exception LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) - LOGGER.Error(ex.message) + LOGGER.Error(ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:") Return Nothing End Try @@ -290,54 +291,60 @@ Public Class ClassControls End If Catch ex As Exception LOGGER.Info(" - Unvorhergesehener Unexpected error in Renew_ComboboxResults - Fehler: " & vbNewLine & ex.Message) - LOGGER.Error(ex.message) + LOGGER.Error(ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Renew_ComboboxResults:") End Try End Sub - Public Function AddTextBox(indexname As String, y As Integer, text As String, DataType As String) As TextBox - Dim txt As New TextBox With { + Public Function AddTextBox(indexname As String, y As Integer, text As String, DataType As String) As DevExpress.XtraEditors.TextEdit + Dim oEdit As New DevExpress.XtraEditors.TextEdit With { .Name = "txt" & indexname, .Size = New Size(260, 27), .Location = New Point(11, y), - .Tag = New ControlMeta() With { + .Tag = New ControlMeta() With { .IndexName = indexname, .IndexType = DataType } } - If text <> "" Then - txt.Text = text - txt.Size = New Size(CInt(text.Length * 15), 27) - txt.SelectAll() + Select Case DataType + Case "INTEGER" + oEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric + End Select + + If text IsNot Nothing Then + oEdit.Text = text + oEdit.SelectAll() End If - AddHandler txt.GotFocus, AddressOf OnTextBoxFocus - AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus - AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp - AddHandler txt.TextChanged, AddressOf OnTextBoxTextChanged - Return txt + + AddHandler oEdit.GotFocus, AddressOf OnTextBoxFocus + AddHandler oEdit.LostFocus, AddressOf OnTextBoxLostFocus + AddHandler oEdit.KeyUp, AddressOf OnTextBoxKeyUp + AddHandler oEdit.TextChanged, AddressOf OnTextBoxTextChanged + + Return oEdit End Function Public Sub OnTextBoxFocus(sender As System.Object, e As System.EventArgs) - Dim oTextbox As TextBox = sender + Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender oTextbox.BackColor = Color.Lime oTextbox.SelectAll() End Sub Public Sub OnTextBoxTextChanged(sender As System.Object, e As System.EventArgs) - Dim oTextbox As TextBox = sender + Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender Using oGraphics As Graphics = oTextbox.CreateGraphics() oTextbox.Width = oGraphics.MeasureString(oTextbox.Text, oTextbox.Font).Width + 15 End Using End Sub Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs) - Dim oTextbox As TextBox = sender + Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender oTextbox.BackColor = Color.White End Sub Public Sub OnTextBoxKeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) - Dim oTextbox As TextBox = sender + Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender If oTextbox.Text = String.Empty Then Exit Sub @@ -445,7 +452,7 @@ Public Class ClassControls LOGGER.Warn("Error in SQL Command: {0}", SqlCommand) End If - If TypeOf oFoundControl Is TextBox Then + If TypeOf oFoundControl Is DevExpress.XtraEditors.TextEdit Then If oDatatable.Rows.Count > 0 Then Dim oFirstRow As DataRow = oDatatable.Rows.Item(0) @@ -453,7 +460,7 @@ Public Class ClassControls Dim oValue = oFirstRow.Item(0).ToString() LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, oValue) - DirectCast(oFoundControl, TextBox).Text = oValue + DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue End If End If ElseIf TypeOf oFoundControl Is LookupControl2 Then diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 9053f9d..1ebe854 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -281,7 +281,7 @@ Public Class frmIndex For Each oControl As Control In Me.pnlIndex.Controls ' MsgBox(ctrl.Name) If oControl.Name.StartsWith("txt") Then - Dim box As TextBox = oControl + Dim box As DevExpress.XtraEditors.TextEdit = oControl If box.Text = "" Then Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(box.Name, "txt", "") & "'", MyConnectionString, True) If optional_index = False Then