Private Sub cmdreadboxes_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles cmdreadboxes.Click
Dim i As Integer = 0
Dim datei As String
datei = "C:\Daten.csv"
Dim line As String
Dim x() As String
txt_count = 0
Dim last_top As Integer = 0
Dim last_page As String = 0
Dim ft_l As New Font("Arial", 14, FontStyle.Bold Or FontStyle.Underline)
Dim ft_t As New Font("Arial", 12, FontStyle.Regular)
vars.Clear()
TB.Visible = False
Try
Dim readText() As String = File.ReadAllLines(datei)
Me.SuspendLayout()
TB.SuspendLayout()
For Each line In readText
'x(0) ->Tabpage
'x(1) ->TXT/CMB
'x(2) ->Parametername
'x(3) ->Text Angezeigt
'x(4) ->Bildname
'x(5) ->Eingabeüberprüfung (INT/SINGLE/TXT)
x = line.Split(";")
If TB.SelectedTab.Text <> x(0) Then
TB.SelectTab(x(0))
last_top = 0
End If
Select Case x(1)
Case "TXT"
txt(txt_count) = New TextBox
txt(txt_count).Font = ft_t
txt(txt_count).Text = x(2)
txt(txt_count).Top = last_top
txt(txt_count).Left = 270
txt(txt_count).Width = 200
txt(txt_count).Name = x(2)
TB.SelectedTab.Controls.Add(txt(txt_count))
If x(3) = "" Then
add_label(last_top, x(2), ft_t) 'Wenn kein
' beschreibungstext, dann parametername
Else
add_label(last_top, x(3), ft_t)
End If
last_top = last_top + 30
AddHandler txt(txt_count).Click, AddressOf Handler_txt
txt_count = txt_count + 1
vars.Add(x(2))
Case "GRUPPE"
lbl(lbl_count) = New Label
lbl(lbl_count).Font = ft_l
lbl(lbl_count).Width = 500
lbl(lbl_count).BackColor = Color.LightGreen
lbl(lbl_count).Text = x(3) '&
' "________________________________________________"
lbl(lbl_count).Top = last_top
last_top = last_top + 30
lbl(lbl_count).Left = 10
lbl(lbl_count).Name = lbl_count
TB.SelectedTab.Controls.Add(lbl(lbl_count))
lbl_count = lbl_count + 1
Case "CMB"
cmb(cmb_count) = New ComboBox
cmb(cmb_count).Font = ft_t
cmb(cmb_count).Top = last_top
cmb(cmb_count).Left = 270
cmb(cmb_count).Width = 200
cmb(cmb_count).Name = cmb_count 'x(2)
cmb(cmb_count).Items.AddRange(x(6).Split("|"))
cmb(cmb_count).SelectedIndex = 0
TB.SelectedTab.Controls.Add(cmb(cmb_count))
cmb_count = cmb_count + 1
If x(3) = "" Then
add_label(last_top, x(2), ft_t) 'Wenn kein
' beschreibungstext, dann parametername
Else
add_label(last_top, x(3), ft_t)
End If
last_top = last_top + 30
vars.Add(x(2))
End Select
If x(2) = "" And x(1) <> "GRUPPE" Then
MsgBox("Fehlerhafte Eingabedatei! In der Parameter Datei" & _
"kein Parametername vergeben!", MsgBoxStyle.Critical)
End If
Array.Clear(x, 0, x.Length)
Next
TB.Visible = True
Me.ResumeLayout()
TB.ResumeLayout()
ReDim Preserve cmb(cmb_count - 1)
ReDim Preserve lbl(lbl_count - 1)
ReDim Preserve txt(txt_count - 1)
ReDim Preserve info_lbl(info_lbl_count - 1)
Catch Ex As Exception
MsgBox("Fehler!" & Ex.Message)
Exit Sub
End Try
End Sub |