hello everybody !
I get this error 3 times : "The output parameter must be assigned before
the control leaves the current method" (dor dMin and dMax)
this one 1 time : Use of the parameter 'out' is not assigned 'dMax'
This is my first steps in C#: i can't manage(understa nd) this error.
I would like to test to variables which can be change on form1 by 2 numeric
updown controls before sending them to a UserControl which make some
calculation with these 2 numbers like this :
if (_genData.Numbe rMin < _genData.Number Max)
{
S = (int)(_rand.Nex t((int)_genData .NumberMin,
(int)_genData.N umberMax + 1) / 3) * 3;
}
else
{
//Choisir le nombre cible (_iS) compris dans la fourchette
et le rendre multiple de trois.
// Set the target number (_iS) in the range and make
multiple of three.
So if user modify the value and nudNumMin .Value becomes nudNumMax
..Value the calculation could send an error in calculating the value S.
That's why i have to test and correct the values before sending them to the
UserControl.
the code in form1 is :
#region min max check
string message = "Attention ! Le nombre maximal doit être au
nombre minimal. L'erreur sera corrigée";
string caption = "Erreur dans le choix de la taille des nombres.";
MessageBoxButto ns buttons = MessageBoxButto ns.OK;
DialogResult result;
// this method checks the values and shows an error message if
// they are not as expected and corrects them to a valid state
public bool CheckMinMaxValu es(out int dMin, out int dMax)
{
if ( nudNumMin .Value nudNumMax .Value )
{
result = MessageBox.Show (message, caption, buttons);
dMin = dMax - 1;
return false;
}
return true;
}
#endregion //min max check
and then :
private void nudNumMax_Value Changed( object sender, EventArgs e )
{
int dMin = (int)nudNumMin. Value;
int dMax = (int)nudNumMax. Value;
if (!CheckMinMaxVa lues(out dMin, out dMax))
{
//... do what ever is needed when the check fails
nudNumMin.Value = dMin;
nudNumMax.Value = dMax;
nudNumMax.Value = nudNumMin.Value + 1;
_currParam.Gene rationData.Numb erMax = (int) nudNumMin.Value
+ 1; // for example
}
_currParam.Gene rationData.Numb erMax = (int)nudNumMax. Value;
ValueChanged( true );
}
I hope you understand me....
and can help me !
pascal
--
http://www.scalpa.info