Answer the question
In order to leave comments, you need to log in
Textbox doesn't return any value, why?
c# wforms.
There are five textboxes and two comboboxes. I need to save and output this data to .txt.
for some reason, neither the textbox nor the combobox returns a value, be it a Latin/Cyrillic character/number. It took me a long time to figure out what the problem is. there is a similar program, but there is no such problem. Does this mean that there is a problem somewhere in the logic of the program itself?
public Form1()
{
InitializeComponent();
textBox1.MaxLength = 4; textBox2.MaxLength = 4; textBox3.MaxLength = 4; textBox4.MaxLength = 4;
string path1 = @"C:\\Program Files\\program1\\cfg.txt";
Directory.CreateDirectory(path);
using (StreamWriter swriter = new StreamWriter(path1))
{
swriter.Write("info1: " + textBox1.Text + " " + textBox2.Text + " " + textBox3.Text + " " + textBox4.Text + "\n"
+ "info2: " + comboBox1.SelectedItem + "/" + comboBox2.SelectedItem + "\n"
+ "info3" + textBox5.Text);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question