Crystas
New member
- Joined
- Sep 13, 2021
- Messages
- 1
- Programming Experience
- Beginner
I'm stuck...
Form1:
I created an easy Form with Name, LastName and Age.
I save the FirstName and LastName in a log.txt file and i want to use it in Form2, but i can't get it to work.
Here is the part of the code that i save the First/Last name.
Form2:
Here is the part where i keep changing things,
But if it wants to load the log.txt file it can't find it because it isn't created yet, but i want to use the name that the user use in log.txt
And that man is hanging alot in my tests and will get the message to the directory.log.txt but it doesn't show the words.
ATM i only have:
Form1:
I created an easy Form with Name, LastName and Age.
I save the FirstName and LastName in a log.txt file and i want to use it in Form2, but i can't get it to work.
Here is the part of the code that i save the First/Last name.
Form1:
private void btn_next_Click(object sender, EventArgs e)
{
// use Path.Combine to combine 2 strings to a path
File.WriteAllText(Path.Combine("log.txt"), txt_firstname.Text + " " + textBox2.Text);
if (txt_firstname.Text == "" || textBox2.Text == "" || textBox1.Text == "")
{
MessageBox.Show("Please fill all the form fields!");
return;
}
else
{
Galgje myForm = new Galgje();
this.Hide();
myForm.Show(this);
}
}
Form2:
Here is the part where i keep changing things,
But if it wants to load the log.txt file it can't find it because it isn't created yet, but i want to use the name that the user use in log.txt
And that man is hanging alot in my tests and will get the message to the directory.log.txt but it doesn't show the words.
ATM i only have:
Form2:
private void button1_Click(object sender, EventArgs e)
{
//Ended here need to fix it
target = Path.Combine(Directory.GetCurrentDirectory());
}