I have made a quiz form .
This first form is welcome f开发者_如何转开发orm that contains 2 buttons: register and start test. When you click on start test the click event of the button runs this code
Quiz_interface obj1 = new Quiz_interface();
obj1.Visible = true;
to opening a new form for displaying questions .
Now the problem part :
If I add another button or image in this quiz_interface part and add click event with this code
result obj2 = new result();
obj2.Visible = true;
I get this error InvalidOperationException handled. Failed to initialize because catogory name was missing.
What is the possible way around for this?
I'm guessing that your "result" object probably doesn't have a "Visible" member to set to true.
Definitely step through under the debugger, and verify the correct line# where it's crashing. If it's "obj2.Visible = true", then make sure obj2 actually has "Visible".
PS: You're not trying to use performance counters in your code, are you?
精彩评论