private void SeeUsersProfile(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index >= 0 && index < usersBindingSource.Count) { UsersViewModel user = usersBindingSource[index] as UsersViewModel; if (user != null) { var form = new MainForm(user.username, currGroup.id); form.ShowDialog(); } } }
/// <summary> /// Opens a form to display requested user. /// </summary> /// <param name="sender">Users grid view.</param> /// <param name="e"></param> private void seeUser(object sender, DataGridViewCellEventArgs e) { int idx = e.RowIndex; if (idx >= 0 && idx < usersBindingSource.Count) { UsersViewModel user = usersBindingSource[idx] as UsersViewModel; this.Enabled = true; var form = new MainForm(user.username, groupId); form.ShowDialog(); } }