Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string Pfad = string.Empty;
- OpenFileDialog openFileDialog1 = new OpenFileDialog();
- openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files(*.*)|*.*";
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- Pfad = openFileDialog1.FileName;
- }
- int index = 0;
- daten = new String[spalten.Length];
- foreach (string item in spalten)
- {
- for (int i = 0; i < spalten.Length; i++)
- {
- daten[i] = item;
- }
- }
- if (!(tB_Name.Text == string.Empty || tB_Passwort.Text == string.Empty || tB_Login.Text == string.Empty))
- {
- daten = new String[spalten.Length + 4];
- foreach (string item in spalten)
- {
- for (int i = 0; i < spalten.Length; i++)
- {
- daten[i] = item;
- }
- }
- // ARRAY NEU ANLEGEN UND UM 3 ERWEITERN DANN WIRD EIN NEUER DATENSATZ HINZUGEFÜGT
- daten[spalten.Length + 1] = tB_Name.Text;
- daten[spalten.Length + 2] = tB_Login.Text;
- daten[spalten.Length + 3] = tB_Passwort.Text;
- }
- System.IO.File.WriteAllText(Pfad, string.Empty);
- for (int i = 0; i < daten.Length / 3; i++)
- {
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(Pfad, true))
- {
- file.WriteLine(daten[index] + "," + daten[index + 1] + "," + daten[index + 2]);
- }
- index++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement