//Overload Constructor public Form1(Int32 intPerson_ID) { InitializeComponent(); //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(); OleDbDataReader 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(); txtstate.Text = 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(); } }
//Overload Constructor public Form1(Int32 intPerson_ID) { InitializeComponent(); //get data for one person and fill the fields PersonV2 temp = new PersonV2(); OleDbDataReader 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(); txtstate.Text = 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(); } }