![]() |
| ||
| if statement problems I'm having problems with if statements present value (PV) should be no larger than $10000 interest rate is not higher than 10 and no less than 2 and number of years at least 3 I've tried the if statements with error messageboxs but I was getting confused with all the if's and the messagebox didn't show up right. The following code is my code before entering the if's. Any insight would be very helpful, thank you. Public Class Form1 |
| ||
| Re: if statement problems I'm assuming you want to check the values before making the call to the FV function. If that's the case, you could accomplish what you're trying to do with three simple if statements. Something like the following would probably work just fine: Private Sub compute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles compute.Click If you just need something simple, this should work. You may want to change the conversions depending on what you're assuming will be input from the text fields, and you would obviously want to use some kind of exception handling anytime you're converting the text from user input into various data types. |
| ||
| Re: if statement problems The way I should implement is : using the LostFocus event for the textboxes. After the lostfocus you can warn a user corresponding the maximum or minimum values needed. Second is creating yourself a class in which you calculate the FV. code below: Public Class Class1 formcode: Public Class Form1 |
| ||
| Re: if statement problems thanks it worked bcasp, much appreciated !! |
| All times are GMT -4. The time now is 12:45 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC