private void btnfind_Click(object sender, EventArgs e) { try { String nic = txtfind.Text; DataSet ds = pbal.Find_Emp(nic); DataRow row; row = ds.Tables[0].Rows[0]; MessageBox.Show(row["NIC"].ToString()); // GridBind(); foreach (DataRow rows in ds.Tables[0].Rows) { txtempid.Text = rows["Emp_Id"].ToString(); cmb1.Text = rows["Dep_Name"].ToString(); txtfname.Text = rows["First_Name"].ToString(); txtlname.Text = rows["Last_Name"].ToString(); txtfullname.Text = rows["Full_Name"].ToString(); cbgender.Text = rows["Sex"].ToString(); cmbsta.Text = rows["M_Sta"].ToString();// dateTimePicker1.Text = rows["D_O_Birth"].ToString(); txtnic.Text = rows["NIC"].ToString(); cmbconf.Text = rows["Confirmation"].ToString();// txtaddress.Text = rows["Address"].ToString(); txtcity.Text = rows["City"].ToString(); txtcountry.Text = rows["Country"].ToString(); txtbisnum.Text = rows["Business_Number"].ToString(); txthomenum.Text = rows["Home_Number"].ToString(); txtnote.Text = rows["Basic_sal"].ToString();// txtdesig.Text = rows["Designation"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }