Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Anzahl = 0 Dim ListComboTyp() As String = {"", "R/R", "R/R mit Fr", "B/B ; E/E", "B/B ; E/E mit Fr", "F/F", "F/F mit Fr",
"V/V", "V/V mit Fr", "L/L (Bördel)", "L/L mit Fr (Bördel)", "L/L (Bund)", "L/L mit Fr (Bund)"}
Dim ListUO() As String = {"", "und", "oder"}
ComboUO1.Items.Clear()
ComboUO1.Items.AddRange(ListUO)
ComboUO1.SelectedIndex = 0
ComboUO2.Items.Clear()
ComboUO2.Items.AddRange(ListUO)
ComboUO2.SelectedIndex = 0
ComboTyp.Items.Clear()
ComboTyp.Items.AddRange(ListComboTyp)
For i = 1 To 30
Try
Me.Controls.Remove(txtNr(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtStk(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtBezSt(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtBezStEngl(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtBen(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtMat(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtMatDIN(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtAPZ(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtTNr(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(txtMVN(i))
Catch ex As Exception
End Try
Try
Me.Controls.Remove(ComboSuchTNr(i))
Catch ex As Exception
End Try
Next
Try
For Each objtxt In Me.Controls
If TypeName(objtxt) = "TextBox" Then
objtxt.Text = ""
End If
Next
Catch ex As Exception
End Try
Try
txtProjekt.Text = Builder.CustomPropertyTable.Item("KomProjektNr")
txtAuftragsNr.Text = Builder.CustomPropertyTable.Item("KomAuftragsNr")
txtNormNr.Text = Builder.CustomPropertyTable.Item("KomNormNr")
txtDN.Text = Builder.CustomPropertyTable.Item("KomDN")
txtPN.Text = Builder.CustomPropertyTable.Item("KomPN")
txtBez.Text = Builder.CustomPropertyTable.Item("KomBezeichnung")
txtBezEngl.Text = Builder.CustomPropertyTable.Item("KomBezEngl")
txtTypennomenklatur.Text = Builder.CustomPropertyTable.Item("KomTypennomenklatur")
txtZeichnungsnummer.Text = Builder.CustomPropertyTable.Item("KomZeichnungsnummer")
txtPNr.Text = Builder.CustomPropertyTable.Item("KomPNr")
txtStück.Text = Builder.CustomPropertyTable.Item("KomStückzahl")
txtGewicht.Text = Builder.CustomPropertyTable.Item("KomGewicht")
txtKundenZNr.Text = Builder.CustomPropertyTable.Item("KomKundenZNr")
txtErstelltDatum.Text = Builder.CustomPropertyTable.Item("KomErstelltDatum")
txtErstelltName.Text = Builder.CustomPropertyTable.Item("KomErstelltName")
txtGeprüftDatum.Text = Builder.CustomPropertyTable.Item("KomGeprüftDatum")
txtGeprüftName.Text = Builder.CustomPropertyTable.Item("KomGeprüftName")
txtBetriebsdruck.Text = Builder.CustomPropertyTable.Item("KomBetriebsdruck")
txtTemp.Text = Builder.CustomPropertyTable.Item("KomBetriebstemperatur")
txtPrüfdruck.Text = Builder.CustomPropertyTable.Item("KomPrüfdruck")
txtMedium.Text = Builder.CustomPropertyTable.Item("KomMedium")
txtMediumEngl.Text = Builder.CustomPropertyTable.Item("KomMediumEngl")
txtFluidgruppe.Text = Builder.CustomPropertyTable.Item("KomFluidgruppe")
txtAx.Text = Builder.CustomPropertyTable.Item("KomAX")
txtLat.Text = Builder.CustomPropertyTable.Item("KomLAT")
txtAng.Text = Builder.CustomPropertyTable.Item("KomANG")
ComboUO1.Text = Builder.CustomPropertyTable.Item("KomUO1")
ComboUO2.Text = Builder.CustomPropertyTable.Item("KomUO2")
txtCax.Text = Builder.CustomPropertyTable.Item("KomCAX")
txtClat.Text = Builder.CustomPropertyTable.Item("KomCLAT")
txtCw.Text = Builder.CustomPropertyTable.Item("KomCW")
txtFläche.Text = Builder.CustomPropertyTable.Item("KomWirkFläche")
txtLastspiele.Text = Builder.CustomPropertyTable.Item("KomLastspiele")
For i = 1 To 30
If Not Builder.CustomPropertyTable.Item("StlStk" & i) = "-" And Not Builder.CustomPropertyTable.Item("StlStk" & i) = "" Then
Stück(i) = Builder.CustomPropertyTable.Item("StlStk" & i)
Bezeichnung(i) = Builder.CustomPropertyTable.Item("StlBenennung" & i)
BezeichnungEngl(i) = Builder.CustomPropertyTable.Item("StlBenennungEngl" & i)
Benennung(i) = Builder.CustomPropertyTable.Item("StlAbmessung" & i)
Material(i) = Builder.CustomPropertyTable.Item("StlWerkstoff" & i)
MaterialDIN(i) = Builder.CustomPropertyTable.Item("StlWerkstoffnorm" & i)
APZ(i) = Builder.CustomPropertyTable.Item("StlAPZ" & i)
TeileNr(i) = Builder.CustomPropertyTable.Item("StlTeileNr" & i)
MVN(i) = Builder.CustomPropertyTable.Item("StlMVN" & i)
Anzahl += 1
End If
Next
If Not Anzahl = 0 Then Stücklistenzeilen()
Catch ex As Exception
MsgBox("Feeeehler")
End Try
If txtMedium.Text = "" Or txtMedium.Text = " " Or txtMedium.Text = "-" Or txtMedium.Text = "0" Then
txtMedium.Text = "Unbekannt"
End If
If txtFluidgruppe.Text = "" Or txtFluidgruppe.Text = " " Or txtFluidgruppe.Text = "-" Or txtFluidgruppe.Text = "0" Then
txtFluidgruppe.Text = "/"
End If
If txtLastspiele.Text = "" Or txtLastspiele.Text = " " Or txtLastspiele.Text = "-" Or txtLastspiele.Text = "0" Then
txtLastspiele.Text = "1000"
End If
If txtErstelltName.Text = "" Or txtErstelltName.Text = " " Or txtErstelltName.Text = "0" Or txtErstelltName.Text = "-" Then
txtErstelltName.Text = Environment.UserName(0).ToString.ToUpper & Environment.UserName.Substring(1)
End If
If txtErstelltDatum.Text = "" Or txtErstelltDatum.Text = " " Or txtErstelltDatum.Text = "0" Or txtErstelltDatum.Text = "-" Then
txtErstelltDatum.Text = Now.Date
End If
If txtGeprüftDatum.Text = "" Or txtGeprüftDatum.Text = " " Or txtGeprüftDatum.Text = "0" Or txtGeprüftDatum.Text = "-" Then
txtGeprüftDatum.Text = Now.Date
End If
End Sub
Sub Stücklistenzeilen()
Try
For i = 1 To Anzahl
txtNr(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtNr(i))
With txtNr(i)
.Name = "txtNr" & i
.Size = New System.Drawing.Size(30, 23)
.Location = New System.Drawing.Point(15, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = i
.AcceptsReturn = False
.Multiline = False
End With
txtStk(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtStk(i))
With txtStk(i)
.Name = "txtStk" & i
.Size = New System.Drawing.Size(30, 23)
.Location = New System.Drawing.Point(58, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = Stück(i)
.AcceptsReturn = False
.Multiline = False
End With
txtBezSt(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtBezSt(i))
With txtBezSt(i)
.Name = "txtBezSt" & i
.Size = New System.Drawing.Size(180, 23)
.Location = New System.Drawing.Point(101, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = Bezeichnung(i)
.AcceptsReturn = False
.Multiline = False
End With
txtBezStEngl(i) = New System.Windows.Forms.TextBox
AddHandler txtBezStEngl(i).GotFocus, AddressOf txtBezStEngl_GotFocus
Me.Controls.Add(txtBezStEngl(i))
With txtBezStEngl(i)
.Name = "txtBezStEngl" & i
.Size = New System.Drawing.Size(120, 23)
.Location = New System.Drawing.Point(101, 463 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 8)
.Text = BezeichnungEngl(i)
.AcceptsReturn = False
.Multiline = False
End With
txtBen(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtBen(i))
With txtBen(i)
.Name = "txtBen" & i
.Size = New System.Drawing.Size(180, 23)
.Location = New System.Drawing.Point(294, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = Benennung(i)
.AcceptsReturn = False
.Multiline = False
End With
txtMat(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtMat(i))
With txtMat(i)
.Name = "txtMat" & i
.Size = New System.Drawing.Size(65, 23)
.Location = New System.Drawing.Point(487, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = Material(i)
.AcceptsReturn = False
.Multiline = False
End With
txtMatDIN(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtMatDIN(i))
With txtMatDIN(i)
.Name = "txtMatDIN" & i
.Size = New System.Drawing.Size(65, 23)
.Location = New System.Drawing.Point(487, 463 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = MaterialDIN(i)
.AcceptsReturn = False
.Multiline = False
End With
txtAPZ(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtAPZ(i))
With txtAPZ(i)
.Name = "txtAPZ" & i
.Size = New System.Drawing.Size(120, 23)
.Location = New System.Drawing.Point(565, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = APZ(i)
.AcceptsReturn = False
.Multiline = False
End With
txtTNr(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtTNr(i))
With txtTNr(i)
.Name = "txtTNr" & i
.Size = New System.Drawing.Size(65, 23)
.Location = New System.Drawing.Point(708, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = TeileNr(i)
.AcceptsReturn = False
.Multiline = False
End With
txtMVN(i) = New System.Windows.Forms.TextBox
Me.Controls.Add(txtMVN(i))
With txtMVN(i)
.Name = "txtMVN" & i
.Size = New System.Drawing.Size(50, 23)
.Location = New System.Drawing.Point(786, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 10)
.Text = MVN(i)
.AcceptsReturn = False
.Multiline = False
End With
ComboSuchTNr(i) = New System.Windows.Forms.ComboBox
AddHandler ComboSuchTNr(i).SelectedIndexChanged, AddressOf ComboBoxes_IndexChanged
Me.Controls.Add(ComboSuchTNr(i))
With ComboSuchTNr(i)
.Name = "ComboSuchTNr" & i
.Size = New System.Drawing.Size(300, 45)
.Location = New System.Drawing.Point(870, 440 + ((i - 1) * Zeilenabstand))
.Visible = True
.Font = New Drawing.Font("ISOCPEUR", 8)
.DropDownStyle = Windows.Forms.ComboBoxStyle.DropDownList
End With
txtBezStEngl(i).Focus()
Next
Catch ex As Exception
MsgBox("Es gab ein Fehler beim erstellen der Stücklistenzeilen!" & vbCrLf & ex.StackTrace, vbCritical, "Fehler!")
End Try
End Sub