I am trying to write a Username selector. What is does is create a LinkedList of all usernames (just strings) and then adds two other strings for New User and Cancel. The problem is that when I try to add the extra two strings Guide.BeginShowMessageBox(…) begins throwing an Argument Exception.
Looking at the actual layout of my List shows that it has a null entry at the end. Is their any way to get rid of this? I have also tried using a List and encountered the same problem.
Here is my current code:
Note that MogadeController.Mogade.GetUserNames() gets all previously used usernames.
LinkedList<string> names = new LinkedList<string>();
ICollection<string> col = MogadeController.Mogade.GetUserNames();
foreach (string s in col)
names.AddLast(s);
names.AddLast("New Username");
names.AddLast("Cancel");
IAsyncResult fres = Guide.BeginShowMessageBox("Select New User", "Select a username to use or select New Username to create a new user", names, 0, MessageBoxIcon.None, null, null);
Read the documentation.
You will have to create your own UI if you want to provide the user with more than two options.