Click here to Skip to main content
15,917,328 members

Comments by pyschedelisaurus (Top 1 by date)

pyschedelisaurus 9-Jun-17 9:46am View    
ListViewForm is only suppose to be instantiated once, but QuestionForm can be instantiated multiple times (because in the MainForm there is also a read only textbox that keeps count of how many QuestionForms are opened).

As for the ListViewForm, I used the code below inside where it's once instantiated to prevent the user from opening up more than one:

if (displayListViewToolStripMenuItem.Checked == true)
{
//Checking for form to prevent second instance
if ((tlv == null) || (tlv != null && tlv.IsDisposed))
{
tlv.Show();
}
if (!tlv.Visible)
{
tlv.Show();
}
else
{
tlv.BringToFront();
}
}
else
{
//If display option is pressed again, this will prevent it from unchecking
displayListViewToolStripMenuItem.Checked = true;
}