MS_11.12.2015

This commit is contained in:
SchreiberM
2015-12-11 11:16:57 +01:00
parent 1354113330
commit 16ae3d142f
16 changed files with 660 additions and 332 deletions

View File

@@ -141,7 +141,6 @@ Public Class ClassControlValues
ClearControlValues(controls)
For Each control As Control In controls
'Überhaupt Columns in Grid?
CONTROL_ID = GetControlID_for_RecordID(control.Name, RecordID)
If CONTROL_ID = -1 Then
@@ -150,183 +149,303 @@ Public Class ClassControlValues
If LogErrorsOnly = False Then ClassLogger.Add(">> CONTROL_ID:" & CONTROL_ID, False)
ClearControlValue(control)
If TypeOf control Is ComboBox Then
LoadControlValues(RecordID, FormID, DirectCast(control, ComboBox).Controls)
End If
If TypeOf control Is GroupBox Then
LoadControlValues(RecordID, FormID, DirectCast(control, GroupBox).Controls)
End If
If TypeOf control Is PictureBox Then
LoadControlValue_forControl(RecordID, FormID, DirectCast(control, ComboBox), CONTROL_ID)
'LoadControlValues(RecordID, FormID, DirectCast(control, ComboBox).Controls)
ElseIf TypeOf control Is GroupBox Then
LoadControlValue_forControl(RecordID, FormID, DirectCast(control, GroupBox), CONTROL_ID)
' LoadControlValues(RecordID, FormID, DirectCast(control, GroupBox).Controls)
ElseIf TypeOf control Is PictureBox Then
LoadImage(RecordID, CONTROL_ID, control)
End If
'EINE CheckedListBoxControl
If TypeOf control Is DevExpress.XtraEditors.CheckedListBoxControl Then
If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.CheckedListBoxControl", False)
Dim chklbx As DevExpress.XtraEditors.CheckedListBoxControl
chklbx = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
Dim chklbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
chklbSql = ClassDatabase.Execute_Scalar(chklbSql)
If Not (chklbSql Is Nothing Or chklbSql = String.Empty) Then
If chklbSql.ToString.Contains("@") Then
chklbSql = chklbSql.ToString.Replace("@RECORDID", CURRENT_RECORD_ID)
chklbSql = chklbSql.ToString.Replace("@RECORD_ID", CURRENT_RECORD_ID)
chklbSql = chklbSql.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
If LogErrorsOnly = False Then ClassLogger.Add(">> SQL CheckedListBox: " & chklbSql, False)
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(chklbSql, "LoadControlValues: CheckedListBox")
If DT_ListBox Is Nothing = False Then
chklbx.DataSource = DT_ListBox
Select Case DT_ListBox.Columns.Count
Case 2
chklbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
Case 1
chklbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
End Select
End If
End If
ElseIf (chklbSql = String.Empty) Then
' Wenn keine SQL Command ein leerer String ist,
' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
chklbSql = "SELECT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
Dim result As String = ClassDatabase.Execute_Scalar(chklbSql)
If Not IsNothing(result) Then
If result.ToString <> String.Empty Then
Dim entries() As String = result.Split(";")
For Each entry As String In entries
Dim position = chklbx.FindStringExact(entry)
chklbx.SetItemCheckState(position, CheckState.Checked)
Next
End If
End If
Continue For
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> chklbSql is nothing", False)
End If
chklbx.UnCheckAll()
'Recorddatensätze durchlaufen und überprüfen ob angehakt??
Dim index As Integer = 0
For i As Integer = 0 To chklbx.ItemCount - 1
Dim item = chklbx.GetItem(i)
Dim row As DataRowView = CType(item, DataRowView)
If CInt(row(0)) > 0 Then
'Überprüfen ob es den Record gibt
Dim SQL = "SELECT COUNT(*) FROM TBPMO_RECORD_CONNECT WHERE RECORD1_ID = " & CURRENT_RECORD_ID & " AND RECORD2_ID = " & CInt(row(0))
If ClassDatabase.Execute_Scalar(SQL) = 1 Then
chklbx.SetItemChecked(i, True)
End If
End If
Next
ElseIf TypeOf control Is DevExpress.XtraEditors.ListBoxControl Then
If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.ListBoxControl", False)
Dim lbx As DevExpress.XtraEditors.ListBoxControl
lbx = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
Dim lbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
lbSql = ClassDatabase.Execute_Scalar(lbSql)
If Not (lbSql Is Nothing Or lbSql = String.Empty) Then
If lbSql.ToString.Contains("@") Then
lbSql = lbSql.ToString.Replace("@RECORDID".ToUpper, CURRENT_RECORD_ID)
lbSql = lbSql.ToString.Replace("@RECORD_ID".ToUpper, CURRENT_RECORD_ID)
lbSql = lbSql.ToString.Replace("@PARENTRECORD_ID".ToUpper, CURRENT_PARENTID)
If LogErrorsOnly = False Then ClassLogger.Add(">> SQL ListBox: " & lbSql, False)
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(lbSql, "LoadControlValues: ListBoxControl")
If DT_ListBox Is Nothing = False Then
lbx.DataSource = DT_ListBox
Select Case DT_ListBox.Columns.Count
Case 2
lbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
Case 1
lbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
End Select
If DT_ListBox.Columns.Count > 1 Then
End If
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> DT_ListBox is nothing", False)
End If
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql.ToString NOT Contains(@)", False)
End If
ElseIf (lbSql = String.Empty) Then
' Wenn keine SQL Command ein leerer String ist,
' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
LoadControlValue(RecordID, CONTROL_ID, control)
Continue For
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql is nothing", False)
End If
ElseIf CONTROL_ID <> -1 Then
'If LogErrorsOnly = False Then ClassLogger.Add(">> LoadControlValues CONTROL_ID: " & CONTROL_ID, False)
Else
LoadControlValue(RecordID, CONTROL_ID, control)
End If
''EINE CheckedListBoxControl
'If TypeOf control Is DevExpress.XtraEditors.CheckedListBoxControl Then
' If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.CheckedListBoxControl", False)
' Dim chklbx As DevExpress.XtraEditors.CheckedListBoxControl
' chklbx = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
' Dim chklbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
' chklbSql = ClassDatabase.Execute_Scalar(chklbSql)
' If Not (chklbSql Is Nothing Or chklbSql = String.Empty) Then
' If chklbSql.ToString.Contains("@") Then
' chklbSql = chklbSql.ToString.Replace("@RECORDID", CURRENT_RECORD_ID)
' chklbSql = chklbSql.ToString.Replace("@RECORD_ID", CURRENT_RECORD_ID)
' chklbSql = chklbSql.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL CheckedListBox: " & chklbSql, False)
' 'SQL-Command vorhanden also Ausführen des SQL
' Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(chklbSql, "LoadControlValues: CheckedListBox")
' If DT_ListBox Is Nothing = False Then
' chklbx.DataSource = DT_ListBox
' Select Case DT_ListBox.Columns.Count
' Case 2
' chklbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
' chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
' Case 1
' chklbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
' chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
' End Select
' End If
' End If
' ElseIf (chklbSql = String.Empty) Then
' ' Wenn keine SQL Command ein leerer String ist,
' ' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
' chklbSql = "SELECT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
' Dim result As String = ClassDatabase.Execute_Scalar(chklbSql)
' If Not IsNothing(result) Then
' If result.ToString <> String.Empty Then
' Dim entries() As String = result.Split(";")
' For Each entry As String In entries
' Dim position = chklbx.FindStringExact(entry)
' chklbx.SetItemCheckState(position, CheckState.Checked)
' Next
' End If
' End If
' Continue For
' Else
' If LogErrorsOnly = False Then ClassLogger.Add(">> chklbSql is nothing", False)
' End If
' chklbx.UnCheckAll()
' 'Recorddatensätze durchlaufen und überprüfen ob angehakt??
' Dim index As Integer = 0
' For i As Integer = 0 To chklbx.ItemCount - 1
' Dim item = chklbx.GetItem(i)
' Dim row As DataRowView = CType(item, DataRowView)
' If CInt(row(0)) > 0 Then
' 'Überprüfen ob es den Record gibt
' Dim SQL = "SELECT COUNT(*) FROM TBPMO_RECORD_CONNECT WHERE RECORD1_ID = " & CURRENT_RECORD_ID & " AND RECORD2_ID = " & CInt(row(0))
' If ClassDatabase.Execute_Scalar(SQL) = 1 Then
' chklbx.SetItemChecked(i, True)
' End If
' End If
' Next
'ElseIf TypeOf control Is DevExpress.XtraEditors.ListBoxControl Then
' If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.ListBoxControl", False)
' Dim lbx As DevExpress.XtraEditors.ListBoxControl
' lbx = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
' Dim lbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
' lbSql = ClassDatabase.Execute_Scalar(lbSql)
' If Not (lbSql Is Nothing Or lbSql = String.Empty) Then
' If lbSql.ToString.Contains("@") Then
' lbSql = lbSql.ToString.Replace("@RECORDID".ToUpper, CURRENT_RECORD_ID)
' lbSql = lbSql.ToString.Replace("@RECORD_ID".ToUpper, CURRENT_RECORD_ID)
' lbSql = lbSql.ToString.Replace("@PARENTRECORD_ID".ToUpper, CURRENT_PARENTID)
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL ListBox: " & lbSql, False)
' 'SQL-Command vorhanden also Ausführen des SQL
' Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(lbSql, "LoadControlValues: ListBoxControl")
' If DT_ListBox Is Nothing = False Then
' lbx.DataSource = DT_ListBox
' Select Case DT_ListBox.Columns.Count
' Case 2
' lbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
' lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
' Case 1
' lbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
' lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
' End Select
' If DT_ListBox.Columns.Count > 1 Then
' End If
' Else
' If LogErrorsOnly = False Then ClassLogger.Add(">> DT_ListBox is nothing", False)
' End If
' Else
' If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql.ToString NOT Contains(@)", False)
' End If
' ElseIf (lbSql = String.Empty) Then
' ' Wenn keine SQL Command ein leerer String ist,
' ' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
' LoadControlValue(RecordID, CONTROL_ID, control)
' Continue For
' Else
' If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql is nothing", False)
' End If
'ElseIf CONTROL_ID <> -1 Then
' 'If LogErrorsOnly = False Then ClassLogger.Add(">> LoadControlValues CONTROL_ID: " & CONTROL_ID, False)
' LoadControlValue(RecordID, CONTROL_ID, control)
'End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in LoadControlValues:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Shared Sub LoadControlValue_forControl(RecordID As Integer, FormID As Integer, control As System.Windows.Forms.Control, CONTROL_ID As Integer)
Try
'EINE CheckedListBoxControl
If TypeOf control Is DevExpress.XtraEditors.CheckedListBoxControl Then
If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.CheckedListBoxControl", False)
Dim chklbx As DevExpress.XtraEditors.CheckedListBoxControl
chklbx = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
Public Shared Sub LoadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
Dim chklbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
chklbSql = ClassDatabase.Execute_Scalar(chklbSql)
If Not (chklbSql Is Nothing Or chklbSql = String.Empty) Then
If chklbSql.ToString.Contains("@") Then
chklbSql = chklbSql.ToString.Replace("@RECORDID", CURRENT_RECORD_ID)
chklbSql = chklbSql.ToString.Replace("@RECORD_ID", CURRENT_RECORD_ID)
chklbSql = chklbSql.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
If LogErrorsOnly = False Then ClassLogger.Add(">> SQL CheckedListBox: " & chklbSql, False)
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(chklbSql, "LoadControlValue_forControl: CheckedListBox")
If DT_ListBox Is Nothing = False Then
chklbx.DataSource = DT_ListBox
Select Case DT_ListBox.Columns.Count
Case 2
chklbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
Case 1
chklbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
chklbx.ValueMember = DT_ListBox.Columns(0).ColumnName
End Select
For Each C As Control In controls
If TypeOf C Is ComboBox Then
Dim Combobox = DirectCast(C, ComboBox)
Dim SQL As String = String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE FORM_ID = {0} AND NAME = '{1}'", CURRENT_FORM_ID, C.Name)
Dim SQL2 As String = ClassDatabase.Execute_Scalar(SQL)
If SQL2 = "" Then
Exit Sub
End If
If SQL2.ToString.ToUpper.Contains("@") Then
SQL2 = SQL2.ToString.Replace("@RECORDID", CURRENT_RECORD_ID)
SQL2 = SQL2.ToString.Replace("@RECORD_ID", CURRENT_RECORD_ID)
SQL2 = SQL2.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL Combobox: " & cmbSql, False)
End If
Dim DT_Combobox As DataTable = ClassDatabase.Return_Datatable(SQL2)
If DT_Combobox Is Nothing = False Then
If DT_Combobox.Rows.Count > 0 Then
Combobox.DataSource = DT_Combobox
Combobox.DisplayMember = DT_Combobox.Columns(1).ColumnName
Combobox.ValueMember = DT_Combobox.Columns(0).ColumnName
Combobox.AutoCompleteMode = AutoCompleteMode.Append
Combobox.AutoCompleteSource = AutoCompleteSource.ListItems
End If
End If
Dim iWidestWidth As Integer = 300
For Each row As DataRow In DT_Combobox.Rows
'Die BReite der DropDown-Lsit anpassen
Using g As Graphics = Combobox.CreateGraphics
If g.MeasureString(row.Item(1).ToString, Combobox.Font).Width + 30 > iWidestWidth Then
iWidestWidth = g.MeasureString(row.Item(1).ToString, Combobox.Font).Width + 30
ElseIf (chklbSql = String.Empty) Then
' Wenn keine SQL Command ein leerer String ist,
' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
chklbSql = "SELECT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
Dim result As String = ClassDatabase.Execute_Scalar(chklbSql)
If Not IsNothing(result) Then
If result.ToString <> String.Empty Then
Dim entries() As String = result.Split(";")
For Each entry As String In entries
Dim position = chklbx.FindStringExact(entry)
chklbx.SetItemCheckState(position, CheckState.Checked)
Next
End If
End If
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> chklbSql is nothing", False)
End If
chklbx.UnCheckAll()
'Recorddatensätze durchlaufen und überprüfen ob angehakt??
Dim index As Integer = 0
For i As Integer = 0 To chklbx.ItemCount - 1
Dim item = chklbx.GetItem(i)
Dim row As DataRowView = CType(item, DataRowView)
If CInt(row(0)) > 0 Then
'Überprüfen ob es den Record gibt
Dim SQL = "SELECT COUNT(*) FROM TBPMO_RECORD_CONNECT WHERE RECORD1_ID = " & CURRENT_RECORD_ID & " AND RECORD2_ID = " & CInt(row(0))
If ClassDatabase.Execute_Scalar(SQL) = 1 Then
chklbx.SetItemChecked(i, True)
End If
End If
Next
ElseIf TypeOf control Is DevExpress.XtraEditors.ListBoxControl Then
If LogErrorsOnly = False Then ClassLogger.Add(">> control DevExpress.XtraEditors.ListBoxControl", False)
Dim lbx As DevExpress.XtraEditors.ListBoxControl
lbx = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
Dim lbSql As String = "SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID
lbSql = ClassDatabase.Execute_Scalar(lbSql)
If Not (lbSql Is Nothing Or lbSql = String.Empty) Then
If lbSql.ToString.Contains("@") Then
lbSql = lbSql.ToString.Replace("@RECORDID".ToUpper, CURRENT_RECORD_ID)
lbSql = lbSql.ToString.Replace("@RECORD_ID".ToUpper, CURRENT_RECORD_ID)
lbSql = lbSql.ToString.Replace("@PARENTRECORD_ID".ToUpper, CURRENT_PARENTID)
If LogErrorsOnly = False Then ClassLogger.Add(">> SQL ListBox: " & lbSql, False)
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(lbSql, "LoadControlValue_forControl: ListBoxControl")
If DT_ListBox Is Nothing = False Then
lbx.DataSource = DT_ListBox
Select Case DT_ListBox.Columns.Count
Case 2
lbx.DisplayMember = DT_ListBox.Columns(1).ColumnName
lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
Case 1
lbx.DisplayMember = DT_ListBox.Columns(0).ColumnName
lbx.ValueMember = DT_ListBox.Columns(0).ColumnName
End Select
If DT_ListBox.Columns.Count > 1 Then
End If
g.Dispose()
End Using
' control.Items.Add(row.Item(0).ToString)
Next
If iWidestWidth > 300 Then
Combobox.DropDownWidth = Math.Max(iWidestWidth, Combobox.Width)
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> DT_ListBox is nothing", False)
End If
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql.ToString NOT Contains(@)", False)
End If
LoadControlValue(RecordID, GetControlID_for_Name(Combobox.Name, FormID), C)
ElseIf (lbSql = String.Empty) Then
' Wenn keine SQL Command ein leerer String ist,
' lade das Control ohne Datenbank, da es wahrscheinlich eine Static List ist
LoadControlValue(RecordID, CONTROL_ID, control)
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> lbSql is nothing", False)
End If
ElseIf CONTROL_ID <> -1 Then
'If LogErrorsOnly = False Then ClassLogger.Add(">> LoadControlValue_forControl CONTROL_ID: " & CONTROL_ID, False)
LoadControlValue(RecordID, CONTROL_ID, control)
End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in LoadControlValue_forControl:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Shared Sub LoadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
Try
For Each Ctrl As Control In controls
If TypeOf Ctrl Is ComboBox Then
Dim Combobox = DirectCast(Ctrl, ComboBox)
Dim SQL As String = String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE FORM_ID = {0} AND NAME = '{1}'", CURRENT_FORM_ID, Ctrl.Name)
Dim SQL2 As String = ClassDatabase.Execute_Scalar(SQL)
If SQL2 = "" Then
Exit Sub
End If
If SQL2.ToString.ToUpper.Contains("@") Then
SQL2 = SQL2.ToString.Replace("@RECORDID", CURRENT_RECORD_ID)
SQL2 = SQL2.ToString.Replace("@RECORD_ID", CURRENT_RECORD_ID)
SQL2 = SQL2.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL Combobox: " & cmbSql, False)
End If
Dim DT_Combobox As DataTable = ClassDatabase.Return_Datatable(SQL2)
If DT_Combobox Is Nothing = False Then
If DT_Combobox.Rows.Count > 0 Then
Combobox.DataSource = DT_Combobox
Combobox.DisplayMember = DT_Combobox.Columns(1).ColumnName
Combobox.ValueMember = DT_Combobox.Columns(0).ColumnName
Combobox.AutoCompleteMode = AutoCompleteMode.Append
Combobox.AutoCompleteSource = AutoCompleteSource.ListItems
End If
Dim iWidestWidth As Integer = 300
For Each row As DataRow In DT_Combobox.Rows
'Die BReite der DropDown-Lsit anpassen
Using g As Graphics = Combobox.CreateGraphics
If g.MeasureString(row.Item(1).ToString, Combobox.Font).Width + 30 > iWidestWidth Then
iWidestWidth = g.MeasureString(row.Item(1).ToString, Combobox.Font).Width + 30
End If
g.Dispose()
End Using
' control.Items.Add(row.Item(0).ToString)
Next
If iWidestWidth > 300 Then
Combobox.DropDownWidth = Math.Max(iWidestWidth, Combobox.Width)
End If
LoadControlValue(RecordID, GetControlID_for_Name(Combobox.Name, FormID), Ctrl)
End If
End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in LoadControlValuesList:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub