Created
December 18, 2014 20:24
-
-
Save joebuschmann/c54d16c3cff101960f91 to your computer and use it in GitHub Desktop.
The correct way to display a WinForms modal dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void btnShowUserDialog_Click(object sender, EventArgs e) | |
{ | |
using (var form = new SelectUserForm()) | |
{ | |
form.SelectedUsers = SelectedUsers; | |
if (form.ShowDialog(this) == DialogResult.OK) | |
{ | |
SelectedUsers = form.SelectedUsers; | |
lblUsers.Text = SelectedUsers.Values.ToDelimitedString(", "); | |
lblUsers.Tag = SelectedUsers.Keys.ToDelimitedString(","); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment