I want a single button to fill in multiple text boxes if the text box above it is already filled. I.E. IF textbox1 = file.shp THEN textbox2 = openFileDialog
I tried doing something with the length function but when I selected a file both textbox1 and 2 were filled.
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = @"C:\WCGIS\GEOG489\Final\SHP";
openFileDialog1.Title = "Browse Text Files";
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckPathExists = true;
openFileDialog1.DefaultExt = "txt";
openFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.ReadOnlyChecked = true;
openFileDialog1.ShowReadOnly = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
if (textBox1.Text.Length > 1)
{
textBox2.Text = openFileDialog1.FileName;
}
}
}
I want to be able to have a new textbox populate everytime I click the "add Shapefile" button. If textbox1 is already occupied I want textbox2 to populate.