private void userListBox_MouseDoubleClick(object sender, MouseEventArgs e) { try { User selecteduser = (User)userListBox.SelectedItem; try { foreach (User search in Program.Users) { if (search.Username == selecteduser.Username) { user = search; } } } catch (Exception) { } loggedinForm loggedinform = new loggedinForm(user); user.Username = selecteduser.Username; user.Credits = selecteduser.Credits; this.Hide(); loggedinform.ShowDialog(); this.Close(); } catch (Exception) { } }
private void loginButton_Click(object sender, EventArgs e) { User selecteduser = (User)userListBox.SelectedItem; try { foreach (User search in Program.Users) { if (search.Username == selecteduser.Username) { user = search; } } } catch (Exception) { MessageBox.Show("Selecteer een gebruiker"); return; } loggedinForm loggedinform = new loggedinForm(user); user.Username = selecteduser.Username; user.Credits = selecteduser.Credits; this.Hide(); loggedinform.ShowDialog(); this.Close(); }