//Overload Constructor public Form1(Int32 intPerson_ID) { InitializeComponent(); cmbState = PayneTools.FillStatesDDL(cmbState); //disable buttons when there is no need for them btnSubmit.Visible = false; btnSubmit.Enabled = false; //get data for one person and fill the fields PersonV2 temp = new PersonV2(); SqlDataReader dr = temp.FindOnePerson(intPerson_ID); //fill FindOnePerson into form while (dr.Read()) { txtfName.Text = dr["FName"].ToString(); txtmName.Text = dr["MName"].ToString(); txtlName.Text = dr["LName"].ToString(); txtstreet1.Text = dr["Street1"].ToString(); txtstreet2.Text = dr["Street2"].ToString(); txtcity.Text = dr["City"].ToString(); cmbState.SelectedItem = dr["State"].ToString(); txtzip.Text = dr["Zip"].ToString(); txtzip2.Text = dr["Zip2"].ToString(); txtphone.Text = dr["Phone"].ToString(); txtemail.Text = dr["Email"].ToString(); txtfacebook.Text = dr["Facebook"].ToString(); //added this labe to be able to use the variable labPerson_ID.Text = dr["ID"].ToString(); } }
//Default Constructor public Form1() { InitializeComponent(); //set default zip code txtzip.Text = "02865"; //disable buttons when there is no need for them btnUpdate.Visible = false; btnUpdate.Enabled = false; btnDelete.Visible = false; btnDelete.Enabled = false; cmbState = PayneTools.FillStatesDDL(cmbState); }