Public Class frmTemplates Dim _TEMPLATEID As Integer Dim _TEMPLATE_ENTITY_ID As Integer Dim loaded As Boolean = False Private Sub TBPMO_TEMPLATEBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TBPMO_TEMPLATEBindingNavigatorSaveItem.Click Me.Validate() Me.TBPMO_TEMPLATEBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.DD_DMSDataSet) End Sub Private Sub frmTemplates_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try Me.TBPMO_TEMPLATETableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPMO_TEMPLATE_ENTITYTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPMO_TEMPLATE_ENTITY_PATTERNTableAdapter.Connection.ConnectionString = MyConnectionString Catch ex As Exception MsgBox("Unexpected error in Load Form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try 'Wertehilfen laden Load_Doctypes() Load_Entities() Load_Templates() End Sub Sub Load_Templates() Try Me.TBPMO_TEMPLATETableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_TEMPLATE) Catch ex As Exception MsgBox("Unexpected error in Load Templates:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Sub Load_Template_Entity(ID As Integer) Try Dim sql As String = "SELECT T1.GUID, 'Entity: ' + T2.NAME + ' - Doctype: ' + T3.BEZEICHNUNG as [Entity Data]" & _ "FROM TBPMO_TEMPLATE T, TBPMO_TEMPLATE_ENTITY T1, TBPMO_FORM T2, TBDD_DOKUMENTART T3 WHERE " & _ "T.GUID = T1.TEMPLATE_ID AND T1.ENTITY_ID = T2.GUID AND T1.DOCTYPE_ID = T3.GUID AND T.GUID = " & ID Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, "Load_Template_Entity") If DT.Rows.Count > 0 Then If DT.Rows.Count = 1 Then ListBox3.Visible = False Label1.Text = DT.Rows(0).Item(1) Label1.Tag = DT.Rows(0).Item(1) Label1.Visible = True Else ListBox3.DataSource = DT ListBox3.DisplayMember = DT.Columns(1).ColumnName ListBox3.ValueMember = DT.Columns(0).ColumnName Label1.Visible = False ListBox3.Visible = True End If Else ListBox3.Visible = False End If Me.TBPMO_TEMPLATE_ENTITYTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_TEMPLATE_ENTITY, ID) Catch ex As Exception MsgBox("Unexpected error in Load Template-Entities:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Sub Load_Template_Patterns(ID As Integer) Try Me.TBPMO_TEMPLATE_ENTITY_PATTERNTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_TEMPLATE_ENTITY_PATTERN, ID) Catch ex As Exception MsgBox("Unexpected error in Load Template-Patterns:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub TBPMO_TEMPLATEBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPMO_TEMPLATEBindingSource.CurrentChanged Load_entity End Sub Private Sub TBPMO_TEMPLATE_ENTITYBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPMO_TEMPLATE_ENTITYBindingSource.CurrentChanged If loaded = True Then If TBPMO_TEMPLATE_ENTITYBindingSource.Position <> -1 Then If DD_DMSDataSet.TBPMO_TEMPLATE_ENTITY.Rows(TBPMO_TEMPLATE_ENTITYBindingSource.Position).Item("TEMPLATE_ID") = _TEMPLATEID Then _TEMPLATE_ENTITY_ID = DD_DMSDataSet.TBPMO_TEMPLATE_ENTITY.Rows(TBPMO_TEMPLATE_ENTITYBindingSource.Position).Item("GUID") End If End If Load_Patterns() End If End Sub Private Sub frmTemplates_Shown(sender As Object, e As EventArgs) Handles Me.Shown loaded = True Load_entity() Load_Patterns() End Sub Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click Load_entity End Sub Sub Load_entity() If GUIDTextBox.Text <> "" Then _TEMPLATEID = GUIDTextBox.Text Load_Template_Entity(GUIDTextBox.Text) End If End Sub Sub Load_Patterns() Load_Template_Patterns(_TEMPLATE_ENTITY_ID) End Sub Sub Load_Doctypes() Try VWPMO_DOKUMENTTYPESTableAdapter.Connection.ConnectionString = MyConnectionString Me.VWPMO_DOKUMENTTYPESTableAdapter.FillBy(Me.DD_DMSDataSet.VWPMO_DOKUMENTTYPES) Catch ex As Exception MsgBox("Unexpected error in Load Doctypes:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Sub Load_Entities() Try VWPMO_GUI_ENTITYTableAdapter.Connection.ConnectionString = MyConnectionString Me.VWPMO_GUI_ENTITYTableAdapter.Fill(Me.DD_DMSDataSet.VWPMO_GUI_ENTITY) Catch ex As Exception MsgBox("Unexpected error in Load Entities:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub ToolStripButton16_Click(sender As Object, e As EventArgs) Handles ToolStripButton16.Click Load_Patterns() End Sub End Class