//this is the logic to start over with a new address private void btn_newDest_Click(object sender, EventArgs e) { stateForm newDest = new stateForm(); newDest.Show(); this.Close(); //close this form so that its fresh when we come back to it. }
private void btnBack_Click(object sender, EventArgs e) { stateForm stateform = new stateForm(); stateform.Show(); this.Close(); }
private void citiesForm_Load(object sender, EventArgs e) { stateForm stateForm = new stateForm(); connection.Open(); //this will open the connection to the access database OleDbCommand command = new OleDbCommand(); //this will give a command to the access database command.Connection = connection; //now the command knows what the connection information is. string commandString = "SELECT * FROM Addresses WHERE [State ab] ='" + stateForm.selectedState + "'"; command.CommandText = commandString; //this declares what query we want to execute; OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { cities.Add(reader.GetString(4)); } connection.Close(); }