I'm VERY new to C#
I need help with a certain Lab Program of mine and I barely know anything in C#. Anyone willing to help please join the VC I am in so that I can show my code and my problem.
16 Replies
Or you can post the code and describe your problem here
uhhh okay
one min
That right there is my code
My problem is with the checking for repeated schedule part
Everytime I try to put an invalid schedule timing deliberately (as in, within another meeting hours) it throws ArgumentOutOfRangeException
That means you're trying to access an array element that does not exist
I don't know why that is happening or how to catch that and lead it to display that message box
If
item.SubItems
has less than three elements, it won't have anything at index 2
You have to remember that arrays in C# are 0-indexed, tooBut I have already scheduled a meeting of the same timing and it is also displayed in the listView...
yeah...I understood that part..
So either that is the issue, or
item.SubItems
does not have as many elements as you think it does
You can always use the debugger to see what it's actual value is
$debugTutorial: Debug C# code and inspect data - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Thank you
I kinda, didn't understand what I have to do about that though..
Sorry
1. Place a breakpoint before you call the code that causes the error
2. Run the debugger
3. When the execution hits the breakpoint, check the values of your variables
See if
item.SubItems
actually contains what you think it containsThank you so much for the help. I just realised how I messed up.
It didn't XD
There you have it
Thank you so much!!
Anytime