-
February 3rd, 2013, 08:08 PM
#16
Re: Find Minimum and Maximum values
Doesn't help I'm trying to do this with a head cold...brain is a little fuzzy.
-
February 3rd, 2013, 08:15 PM
#17
Re: Find Minimum and Maximum values
You're entering another invoice in based on a button click event and a textbox i'm assuming? Therefore, these values you're storing for the min and max invoice totals will run out of scope if you're doing it that way. You need to store them outside of the button click event method.
Code:
private decimal maxInvoice;
private decimal minInvoice;
public void button_click()
{
}
In that kind of setup. That way those values stay in tact even after the code for the button click is finished executing. And you can compare to the new values in the textbox for the next button click event. If you haven't gotten to loops yet, I doubt you're at filestreams or serialization.
[sigpic][/sigpic]
Microsoft MVP .NET Programming (2012 - Present)
®Crestron DMC-T Certified Automation Programmer
-
February 4th, 2013, 09:40 AM
#18
Re: Find Minimum and Maximum values
You were right Ace, declaring maxInvoice and minInvoice preserved the invoice data from one input to the next. Once I declared them outside the calculate button event, it started keeping track properly. In addition, I declared the minInvoice as MaxValue, otherwise it always had a 0 in the smallest invoice field. For anyone else needing such basic help, here's the lines I had to add:
Code:
private decimal maxInvoice;
private decimal minInvoice = Decimal.MaxValue;
Thanks again for all your help guys. I think that once I get into this a little better I won't need as much help.
-
February 4th, 2013, 12:36 PM
#19
Re: Find Minimum and Maximum values
You could even use a nullable type, however, they probably just want you to stick with the normal types. It would eliminate having to set it to the max value as a kind of "safety" mechanism for not staying at 0 for the minimum.
Good you got it working.
Last edited by AceInfinity; February 4th, 2013 at 12:39 PM.
[sigpic][/sigpic]
Microsoft MVP .NET Programming (2012 - Present)
®Crestron DMC-T Certified Automation Programmer
-
February 21st, 2013, 08:30 PM
#20
Re: Find Minimum and Maximum values
Inigo, Would you be able to post the full code you came up with that resulted in a working product, I am doing a quite similar project at the moment and would like to compare if possible.
Thanks in advance!
-
February 21st, 2013, 10:04 PM
#21
Re: Find Minimum and Maximum values
Originally Posted by cdr61804
Inigo, Would you be able to post the full code you came up with that resulted in a working product, I am doing a quite similar project at the moment and would like to compare if possible.
Thanks in advance!
Post a new thread and I will help you out entirely. Comparisons don't allow you to make the best of your learning endeavors.
[sigpic][/sigpic]
Microsoft MVP .NET Programming (2012 - Present)
®Crestron DMC-T Certified Automation Programmer
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
|