private void MyButtonHandler(object sender, EventArgs e) { try { Button btn = (Button)sender; DataClasses1DataContext db = new DataClasses1DataContext(); var q = from UserLogIN in db.UserLogINs select UserLogIN; foreach (var UserLogIN in q) { string sN = UserLogIN.userName; if (sN == btn.Text) { StaffProfile stp = new StaffProfile(UserLogIN.Id); stp.Show(); //MessageBox.Show("Button jeta press korso : " + sN ); break; } } } catch { MessageBox.Show("Invalid Input!"); } }
private void button10_Click(object sender, EventArgs e) { StaffProfile fm = new StaffProfile(userID); fm.Show(); arrTrackOfOpenedForm[arrTrackIndex] = fm; arrTrackIndex++; }
// grid view select for staff profile private void dataGridView1DoubleClick(object sender, EventArgs e) { try { int index = dataGridView1.CurrentCell.RowIndex; //MessageBox.Show(dataGridView1.Rows[index].Cells[0].Value.ToString()); StaffProfile fm = new StaffProfile(Int32.Parse(dataGridView1.Rows[index].Cells[0].Value.ToString())); fm.Show(); arrTrackOfOpenedForm[arrTrackIndex] = fm; arrTrackIndex++; } catch { MessageBox.Show("Invalid Input!"); } }