Hi!
Im a beginner at C# programming. Im studying a class in this language and unfortunatly im stuck:(
The assignment is about a Cinema system.
Userimputs a value-----> if valid it appears on the listbox with person name, ticket price and total revenue for the day.
the above i have no problem with!
The assignment needs me to have two classes. And in this second class
I need to convert the textbox price value into a double value.
so far no problem!
In this second class im requierd to implement a code that checks if the users
code fullfills the minlimit value which is 0 and that it is under the maxLimit
which i have put to a thousand. code looks like this:
public static bool GetDouble(string StringToConvert, out double dblOutValue, double minlimit, double maxlimit= 100) {
bool ConvertedDoubleNumber = Double.TryParse(StringToConvert, out dblOutValue);
if (dblOutValue == maxlimit)
{
MessageBox.Show("Please enter a valid number ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
I assumed that the users imput would get saved in
dblOutValue
but apperantly it does not get saved.
Kepp in mind that this is only a small code. I have a mainform since this is a forms application which has a bunch of code.
The only relevant thing to note here is that a code gets sent to the second class(utillityclass) and gets converted to a double value by suing tryparse.
I need that double value to issue a max/minlimit and for that i need help.
This requiers overloading and I tried that but the variable
dblOutValue
does not exist in the other method since i cant use the same inparametes.
if i only use maxlimit and minlimit i cant get it to work.
Please help!
Regards
Peter!