load textbox if combobox is readonly
This commit is contained in:
parent
a2268dc7fa
commit
e2ea5583ae
@ -622,146 +622,152 @@ Public Class frmValidator
|
|||||||
oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
|
oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
|
||||||
Case "CMB"
|
Case "CMB"
|
||||||
LOGGER.Debug("Versuch CMB zu laden")
|
LOGGER.Debug("Versuch CMB zu laden")
|
||||||
|
If oControlRow.Item("READ_ONLY") Then
|
||||||
|
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
|
||||||
|
oMyControl = cmbReadonly
|
||||||
|
Else
|
||||||
|
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
|
||||||
|
|
||||||
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
|
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
|
||||||
|
AddHandler cmb.GotFocus, Sub(sender As Control, e As EventArgs)
|
||||||
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
|
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
||||||
AddHandler cmb.GotFocus, Sub(sender As Control, e As EventArgs)
|
cmb.BackColor = Color.Lime
|
||||||
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
End If
|
||||||
cmb.BackColor = Color.Lime
|
End Sub
|
||||||
End If
|
AddHandler cmb.LostFocus, Sub(sender As Control, e As EventArgs)
|
||||||
End Sub
|
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
||||||
AddHandler cmb.LostFocus, Sub(sender As Control, e As EventArgs)
|
cmb.BackColor = Color.White
|
||||||
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
End If
|
||||||
cmb.BackColor = Color.White
|
End Sub
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
#Region "CONTROL LIST"
|
#Region "CONTROL LIST"
|
||||||
|
|
||||||
Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name)
|
Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name)
|
||||||
LOGGER.Debug("In add_ComboBox - GUID: " & ControlID)
|
LOGGER.Debug("In add_ComboBox - GUID: " & ControlID)
|
||||||
If ControlID > 0 Then
|
If ControlID > 0 Then
|
||||||
LOGGER.Debug(" >>ControlID > 0")
|
LOGGER.Debug(" >>ControlID > 0")
|
||||||
Dim ConID = Me.TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlID)
|
Dim ConID = Me.TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlID)
|
||||||
If ConID Is Nothing = False Then
|
If ConID Is Nothing = False Then
|
||||||
Dim commandsql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
Dim commandsql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
||||||
LOGGER.Debug("ConID Is Nothing = False")
|
LOGGER.Debug("ConID Is Nothing = False")
|
||||||
If ConID > 0 And commandsql <> "" Then
|
If ConID > 0 And commandsql <> "" Then
|
||||||
LOGGER.Debug("CConID > 0 And TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)")
|
LOGGER.Debug("CConID > 0 And TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)")
|
||||||
Dim connectionString As String
|
Dim connectionString As String
|
||||||
TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConID)
|
TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConID)
|
||||||
Dim DTConnection As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION
|
Dim DTConnection As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION
|
||||||
Dim drConnection As DataRow
|
Dim drConnection As DataRow
|
||||||
For Each drConnection In DTConnection.Rows
|
For Each drConnection In DTConnection.Rows
|
||||||
Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower
|
Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower
|
||||||
Case "ms-sql"
|
Case "ms-sql"
|
||||||
If drConnection.Item("USERNAME") = "WINAUTH" Then
|
If drConnection.Item("USERNAME") = "WINAUTH" Then
|
||||||
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;"
|
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;"
|
||||||
Else
|
Else
|
||||||
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
||||||
End If
|
End If
|
||||||
LOGGER.Debug("ConnString Sql-Server: " & connectionString)
|
LOGGER.Debug("ConnString Sql-Server: " & connectionString)
|
||||||
Case "oracle"
|
Case "oracle"
|
||||||
Dim conn As New OracleConnectionStringBuilder
|
Dim conn As New OracleConnectionStringBuilder
|
||||||
Dim connstr As String
|
Dim connstr As String
|
||||||
If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then
|
If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then
|
||||||
connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
|
connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
|
||||||
drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
||||||
Else
|
Else
|
||||||
conn.DataSource = drConnection.Item("SERVER")
|
conn.DataSource = drConnection.Item("SERVER")
|
||||||
conn.UserID = drConnection.Item("USERNAME")
|
conn.UserID = drConnection.Item("USERNAME")
|
||||||
conn.Password = drConnection.Item("PASSWORD")
|
conn.Password = drConnection.Item("PASSWORD")
|
||||||
conn.PersistSecurityInfo = True
|
conn.PersistSecurityInfo = True
|
||||||
conn.ConnectionTimeout = 120
|
conn.ConnectionTimeout = 120
|
||||||
connstr = conn.ConnectionString
|
connstr = conn.ConnectionString
|
||||||
End If
|
End If
|
||||||
|
|
||||||
connectionString = connstr
|
connectionString = connstr
|
||||||
Case Else
|
Case Else
|
||||||
LOGGER.Info(" - ConnectionType nicht integriert")
|
LOGGER.Info(" - ConnectionType nicht integriert")
|
||||||
MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
|
MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
|
||||||
End Select
|
End Select
|
||||||
Next
|
|
||||||
If connectionString Is Nothing = False Then
|
|
||||||
Try
|
|
||||||
Dim sqlCnn As SqlClient.SqlConnection
|
|
||||||
Dim sqlCmd As SqlClient.SqlCommand
|
|
||||||
Dim adapter As New SqlClient.SqlDataAdapter
|
|
||||||
Dim NewDataset As New DataSet
|
|
||||||
Dim i As Integer
|
|
||||||
Dim sql As String
|
|
||||||
|
|
||||||
|
|
||||||
sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
|
||||||
|
|
||||||
'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, CURRENT_WMFILE)
|
|
||||||
|
|
||||||
'If ClassPatterns.HasOnlySimplePatterns(sql) Then
|
|
||||||
If clsPatterns.HasOnlySimplePatterns(sql) Then
|
|
||||||
sql = clsPatterns.ReplaceInternalValues(sql)
|
|
||||||
sql = clsPatterns.ReplaceControlValues(sql, pnldesigner)
|
|
||||||
LOGGER.Debug(">>> sql after HasOnlySimplePatterns: " & sql)
|
|
||||||
sqlCnn = New SqlClient.SqlConnection(connectionString)
|
|
||||||
' Try
|
|
||||||
sqlCnn.Open()
|
|
||||||
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
|
||||||
adapter.SelectCommand = sqlCmd
|
|
||||||
adapter.Fill(NewDataset)
|
|
||||||
Dim msg As String
|
|
||||||
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
|
||||||
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
|
||||||
Next
|
|
||||||
adapter.Dispose()
|
|
||||||
sqlCmd.Dispose()
|
|
||||||
sqlCnn.Close()
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
|
||||||
LOGGER.Error(ex)
|
|
||||||
LOGGER.Info(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message)
|
|
||||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:")
|
|
||||||
End Try
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
LOGGER.Debug("Else Row 571")
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
LOGGER.Debug("AListe Handling")
|
|
||||||
Dim AListe As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetChoiceListName(ControlID)
|
|
||||||
LOGGER.Debug("In add_ComboBox - AListe: " & AListe)
|
|
||||||
If AListe Is Nothing = False Then
|
|
||||||
'Dim liste = _windreamPM.GetValuesfromAuswahlliste(AListe)
|
|
||||||
Dim liste = WINDREAM.GetValuesfromAuswahlliste(AListe)
|
|
||||||
If liste IsNot Nothing Then
|
|
||||||
cmb.Items.Add("")
|
|
||||||
For Each index As String In liste
|
|
||||||
cmb.Items.Add(index)
|
|
||||||
Next
|
Next
|
||||||
cmb.SelectedIndex = -1
|
If connectionString Is Nothing = False Then
|
||||||
|
Try
|
||||||
|
Dim sqlCnn As SqlClient.SqlConnection
|
||||||
|
Dim sqlCmd As SqlClient.SqlCommand
|
||||||
|
Dim adapter As New SqlClient.SqlDataAdapter
|
||||||
|
Dim NewDataset As New DataSet
|
||||||
|
Dim i As Integer
|
||||||
|
Dim sql As String
|
||||||
|
|
||||||
|
|
||||||
|
sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
||||||
|
|
||||||
|
'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, CURRENT_WMFILE)
|
||||||
|
|
||||||
|
'If ClassPatterns.HasOnlySimplePatterns(sql) Then
|
||||||
|
If clsPatterns.HasOnlySimplePatterns(sql) Then
|
||||||
|
sql = clsPatterns.ReplaceInternalValues(sql)
|
||||||
|
sql = clsPatterns.ReplaceControlValues(sql, pnldesigner)
|
||||||
|
LOGGER.Debug(">>> sql after HasOnlySimplePatterns: " & sql)
|
||||||
|
sqlCnn = New SqlClient.SqlConnection(connectionString)
|
||||||
|
' Try
|
||||||
|
sqlCnn.Open()
|
||||||
|
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
||||||
|
adapter.SelectCommand = sqlCmd
|
||||||
|
adapter.Fill(NewDataset)
|
||||||
|
Dim msg As String
|
||||||
|
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
||||||
|
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
||||||
|
Next
|
||||||
|
adapter.Dispose()
|
||||||
|
sqlCmd.Dispose()
|
||||||
|
sqlCnn.Close()
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
LOGGER.Info(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message)
|
||||||
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:")
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe)
|
LOGGER.Debug("Else Row 571")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe)
|
LOGGER.Debug("AListe Handling")
|
||||||
|
Dim AListe As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetChoiceListName(ControlID)
|
||||||
|
LOGGER.Debug("In add_ComboBox - AListe: " & AListe)
|
||||||
|
If AListe Is Nothing = False Then
|
||||||
|
'Dim liste = _windreamPM.GetValuesfromAuswahlliste(AListe)
|
||||||
|
Dim liste = WINDREAM.GetValuesfromAuswahlliste(AListe)
|
||||||
|
If liste IsNot Nothing Then
|
||||||
|
cmb.Items.Add("")
|
||||||
|
For Each index As String In liste
|
||||||
|
cmb.Items.Add(index)
|
||||||
|
Next
|
||||||
|
cmb.SelectedIndex = -1
|
||||||
|
Else
|
||||||
|
MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Dim maxWith As Integer = cmb.Width
|
Dim maxWith As Integer = cmb.Width
|
||||||
Using g As Graphics = Me.CreateGraphics
|
Using g As Graphics = Me.CreateGraphics
|
||||||
For Each oItem As Object In cmb.Items 'Für alle Einträge...
|
For Each oItem As Object In cmb.Items 'Für alle Einträge...
|
||||||
Dim g1 As Graphics = cmb.CreateGraphics
|
Dim g1 As Graphics = cmb.CreateGraphics
|
||||||
If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then
|
If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then
|
||||||
maxWith = g1.MeasureString(Text, cmb.Font).Width + 30
|
maxWith = g1.MeasureString(Text, cmb.Font).Width + 30
|
||||||
End If
|
End If
|
||||||
g1.Dispose()
|
g1.Dispose()
|
||||||
Next oItem
|
Next oItem
|
||||||
End Using
|
End Using
|
||||||
cmb.DropDownWidth = maxWith
|
cmb.DropDownWidth = maxWith
|
||||||
|
|
||||||
|
oMyControl = cmb
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
oMyControl = cmb
|
|
||||||
|
|
||||||
Case "DTP"
|
Case "DTP"
|
||||||
LOGGER.Debug("Versuch DTP zu laden")
|
LOGGER.Debug("Versuch DTP zu laden")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user