Peter Kiers
asked on
Reading values from the settings.settings file.
Hi,
I have this methode:
My question is about the values in the code line that I have marked with an arrow.
Instead of specifying values I would like to read the values from the settings.settings-file.
Like this:
But I get errors:
Operator '<' cannot be applied to operands of type 'int' and 'string'
Operator '>=' cannot be applied to operands of type 'int' and 'string'
What can I do about this?
Greetings,
Peter Kiers
I have this methode:
private void edtVal1_Validating(object sender, CancelEventArgs e)
{
if (Properties.Settings.Default.IsMGDL)
{
int intVal = Convert.ToInt32(spdVal1.Text);
if (intVal < 70 || intVal >= 140) <===========
{
XtraMessageBox.Show("The value must be between 70 and 140", "Error");
}
}
else
{
double doubleVal = Convert.ToDouble(spdVal1.Text);
if (doubleVal < 1.0 || doubleVal >= 35.0) <===========
{
XtraMessageBox.Show("The value must be between 1.0 and 35.0", "Error");
}
}
}
My question is about the values in the code line that I have marked with an arrow.
Instead of specifying values I would like to read the values from the settings.settings-file.
Like this:
if (intVal < Properties.Settings.Default.MinVal || intVal >= Properties.Settings.Default.MaxVal)
But I get errors:
Operator '<' cannot be applied to operands of type 'int' and 'string'
Operator '>=' cannot be applied to operands of type 'int' and 'string'
What can I do about this?
Greetings,
Peter Kiers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
P.