hallo,
abhänging vom wert eines numericupdown values wird in drei textboxen inee txt gelesen. habe das folgendermaßen formuliert
ich wolltem al fragn ob jemand einen weg mit weniger code kennt.
lg
abhänging vom wert eines numericupdown values wird in drei textboxen inee txt gelesen. habe das folgendermaßen formuliert
ich wolltem al fragn ob jemand einen weg mit weniger code kennt.
VB.NET-Quellcode
- If NumericUpDown1.Value = 0 Then
- ' try weil die txt datei nicht immer existier
- Try ' NUD auf 0
- Karteikarte_1.Text = System.IO.File.ReadAllText(pfad & ".txt")
- Catch ex As Exception
- Karteikarte_1.Text = ""
- End Try
- Try
- Karteikarte_2.Text = System.IO.File.ReadAllText(pfad & "_(2)" & ".txt")
- Catch ex As Exception
- Karteikarte_2.Text = ""
- End Try
- Try
- Karteikarte_3.Text = System.IO.File.ReadAllText(pfad & "_(3)" & ".txt")
- Catch ex As Exception
- Karteikarte_3.Text = ""
- End Try
- ElseIf NumericUpDown1.Value = 1 Then ' NUD auf 1
- ' try weil die txt datei nicht immer existiert (txt zu den bildern).tb1
- Try
- Karteikarte_1.Text = System.IO.File.ReadAllText(pfad & "_(4)" & ".txt")
- Catch ex As Exception
- Karteikarte_1.Text = ""
- End Try
- Try
- Karteikarte_2.Text = System.IO.File.ReadAllText(pfad & "_(5)" & ".txt")
- Catch ex As Exception
- Karteikarte_2.Text = ""
- End Try
- Try
- Karteikarte_3.Text = System.IO.File.ReadAllText(pfad & "_(6)" & ".txt")
- Catch ex As Exception
- Karteikarte_3.Text = ""
- End Try
- ElseIf NumericUpDown1.Value = 2 Then ' NUD auf 2
- ' try weil die txt datei nicht immer existiert (txt zu den bildern).tb1
- Try
- Karteikarte_1.Text = System.IO.File.ReadAllText(pfad & "_(7)" & ".txt")
- Catch ex As Exception
- Karteikarte_1.Text = ""
- End Try
- Try
- Karteikarte_2.Text = System.IO.File.ReadAllText(pfad & "_(8)" & ".txt")
- Catch ex As Exception
- Karteikarte_2.Text = ""
- End Try
- Try
- Karteikarte_3.Text = System.IO.File.ReadAllText(pfad & "_(9)" & ".txt")
- Catch ex As Exception
- Karteikarte_3.Text = ""
- End Try
- End If
lg
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Visual_Prog“ ()