JJ_13_11_NEW CONSTRUCTOR
This commit is contained in:
@@ -74,7 +74,10 @@ Public Class ClassControlValues
|
||||
radio.Checked = CBool(result)
|
||||
Case 3 ' ComboBox
|
||||
Dim combobox As ComboBox = DirectCast(control, ComboBox)
|
||||
'combobox.DataSource = Nothing
|
||||
'combobox.Text = result
|
||||
If combobox.SelectedIndex = -1 Then
|
||||
combobox.DataSource = Nothing
|
||||
combobox.Text = result
|
||||
Else
|
||||
combobox.SelectedIndex = combobox.FindStringExact(result)
|
||||
@@ -247,6 +250,59 @@ Public Class ClassControlValues
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
|
||||
|
||||
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)
|
||||
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.SuggestAppend
|
||||
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), C)
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UnloadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
|
||||
For Each C As Control In controls
|
||||
If TypeOf C Is ComboBox Then
|
||||
Dim Combobox = DirectCast(C, ComboBox)
|
||||
Dim currentValue As String = Combobox.Text
|
||||
Combobox.DataSource = Nothing
|
||||
Combobox.Text = currentValue
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadImage(RecordID As Integer, ControlID As Integer, control As Control)
|
||||
Dim picbox As PictureBox = DirectCast(control, PictureBox)
|
||||
Dim SQL As String = String.Format("SELECT IMG FROM TBPMO_CONTROL_IMAGE WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", RecordID, ControlID)
|
||||
|
||||
Reference in New Issue
Block a user