-
February 21st, 2013, 02:36 PM
#1
-
February 23rd, 2013, 10:41 AM
#2
Re: Beginner C# Program Help Please :)
You'll need to step through and debug your program. If you don't know how to do this, post back.
Also, can you set the text for the text boxes next to the labels beginning with Class (i.e. Class A, Class B, etc.)?
-
February 24th, 2013, 09:47 PM
#3
Re: Beginner C# Program Help Please :)
Thanks for the reply Arjay. I thought I had taken a shot of the output after debugging. I am just selecting "debug" and then "start debugging." This is what happens when I debug(no errors). I input 1 for each field.
-
February 25th, 2013, 02:05 AM
#4
Re: Beginner C# Program Help Please :)
Kinda looks like you have the password character set for that field
Always use [code][/code] tags when posting code.
-
February 25th, 2013, 02:18 AM
#5
Re: Beginner C# Program Help Please :)
[I think I know what is the problem, but since I started to explain how to debug, I'm going to continue]
What debugging allows you to do is to watch the program variables while your program executes. It also allows you to step through each line of code and makes sure variables are getting set as you expect and other logic is working as intended.
So starting by pressing F5 (debug program) is a good start, but to be really useful, you'll need to set one or more breakpoint so the program will stop so you can inspect the variables.
To do this, set a breakpoint at the following line inside the calculaterevenue...click handler:
Code:
classbtickets = decimal.Parse(classbTextBoxrm.Text);
Just put the mouse over the line above, click and then press F9. You'll notice a little circle appears to the left of the line of code.
Next, press F5 to start debugging. Enter the values and click the calculate button.
You'll notice the program will stop on the break point. To inspect a variable, hold the mouse over the classatickets variable. You should see that the value is the same as what you entered. Next, hold the mouse over the classbtickets variable. You should see either null or "" as the value. This is because this line of code hasn't executed yet.
Press F10 to execute the next line of code to inspect more variables or press F5 to continue running the program (and hit additional breakpoints if any).
Okay, so that's a quick debugging primer, now onto your problem.
I suspect the problem is the style of the Totals text box has been set to Password = true. To check this, open the forms editor, right click on the totals text box and choose properties. Then make sure that the Password entry is set to false.
-
February 25th, 2013, 11:14 AM
#6
Re: Beginner C# Program Help Please :)
Thanks guys, that was it. That was pretty silly of me, but now I know a lot more about actual debugging. Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|