P
Pascal
Hello
This is, below, a piece of code that I have a problem with:
In the program (french description here
http://www.scalpa.info/carre_install_clickonce/aide_carre.htm) a number is
generated in the interval given by the value of nudNumMin and nudNumMax.
In the user interface can be created several "projects" appearing in a
listbox, which each have their
characteristics. By clicking on the project in the listbox, controls must
display values for this project( selected at the moment it was build).
If in a project carréA nudNumMax is 20 and nudNumMin is 15 and
in the project carréB nudNumMax is 10 and nudNumMin is 5: When I pass from
one to the other that triggers the warning message and corrects my data
while it should not because min is much lower than max within the same
Project ...
So where and How can I test the values returned by numericupdown controls
only within the same project but not when I change project clicking in the
list box?
THANKS FOR YOUR HELP
Pascal
--
the code :
private void SetMazeGroupControls()
{
_boInitilizing = true;
// misc
chbNewRow.Checked = _currParam.NewRow;
nudMazeCount.Value = (decimal)_currParam.Count;
// generation
nudMazeWidth.Value =
(decimal)_currParam.GenerationData.CarreWidth;
nudNumMin.Value = (decimal)_currParam.GenerationData.NumberMin;
nudNumMax.Value = (decimal)_currParam.GenerationData.NumberMax;
nudCellSize.Value = (decimal)_currParam.ExerciseData.CellSize;
.......
private void lbxMaze_SelectedIndexChanged( object sender, EventArgs e )
{
int iSelected = lbxMaze.SelectedIndex;
if( iSelected >= 0 )
{
MazeItemData item = lbxMaze.Items[ iSelected ] as
MazeItemData;
_currParam = item;
SetMazeGroupControls();
if( Properties.Settings.Default.MarkCurrentMaze )
ValueChanged( false );
}
HandleMazeListButtons();
}
........
private void nudNumMin_ValueChanged(object sender, EventArgs e)
{
if (nudNumMin.Value >= nudNumMax.Value)
{
MessageBox.Show("La valeur minimale doit être inférieure à
la valeur maximale.", "Valeur invalide ", MessageBoxButtons.OK);
nudNumMin.Value = nudNumMax.Value - 1;
}
_currParam.GenerationData.NumberMin = (int)nudNumMin.Value;
ValueChanged(true);
}
private void nudNumMax_ValueChanged(object sender, EventArgs e)
{
if (nudNumMax.Value <= nudNumMin.Value)
{
MessageBox.Show("La valeur maximale doit être supérieure à
la valeur minimale.", "Valeur invalide ", MessageBoxButtons.OK);
nudNumMax.Value = nudNumMin.Value + 1;
}
_currParam.GenerationData.NumberMax = (int)nudNumMax.Value;
ValueChanged(true);
}
http://www.scalpa.info
This is, below, a piece of code that I have a problem with:
In the program (french description here
http://www.scalpa.info/carre_install_clickonce/aide_carre.htm) a number is
generated in the interval given by the value of nudNumMin and nudNumMax.
In the user interface can be created several "projects" appearing in a
listbox, which each have their
characteristics. By clicking on the project in the listbox, controls must
display values for this project( selected at the moment it was build).
If in a project carréA nudNumMax is 20 and nudNumMin is 15 and
in the project carréB nudNumMax is 10 and nudNumMin is 5: When I pass from
one to the other that triggers the warning message and corrects my data
while it should not because min is much lower than max within the same
Project ...
So where and How can I test the values returned by numericupdown controls
only within the same project but not when I change project clicking in the
list box?
THANKS FOR YOUR HELP
Pascal
--
the code :
private void SetMazeGroupControls()
{
_boInitilizing = true;
// misc
chbNewRow.Checked = _currParam.NewRow;
nudMazeCount.Value = (decimal)_currParam.Count;
// generation
nudMazeWidth.Value =
(decimal)_currParam.GenerationData.CarreWidth;
nudNumMin.Value = (decimal)_currParam.GenerationData.NumberMin;
nudNumMax.Value = (decimal)_currParam.GenerationData.NumberMax;
nudCellSize.Value = (decimal)_currParam.ExerciseData.CellSize;
.......
private void lbxMaze_SelectedIndexChanged( object sender, EventArgs e )
{
int iSelected = lbxMaze.SelectedIndex;
if( iSelected >= 0 )
{
MazeItemData item = lbxMaze.Items[ iSelected ] as
MazeItemData;
_currParam = item;
SetMazeGroupControls();
if( Properties.Settings.Default.MarkCurrentMaze )
ValueChanged( false );
}
HandleMazeListButtons();
}
........
private void nudNumMin_ValueChanged(object sender, EventArgs e)
{
if (nudNumMin.Value >= nudNumMax.Value)
{
MessageBox.Show("La valeur minimale doit être inférieure à
la valeur maximale.", "Valeur invalide ", MessageBoxButtons.OK);
nudNumMin.Value = nudNumMax.Value - 1;
}
_currParam.GenerationData.NumberMin = (int)nudNumMin.Value;
ValueChanged(true);
}
private void nudNumMax_ValueChanged(object sender, EventArgs e)
{
if (nudNumMax.Value <= nudNumMin.Value)
{
MessageBox.Show("La valeur maximale doit être supérieure à
la valeur minimale.", "Valeur invalide ", MessageBoxButtons.OK);
nudNumMax.Value = nudNumMin.Value + 1;
}
_currParam.GenerationData.NumberMax = (int)nudNumMax.Value;
ValueChanged(true);
}
http://www.scalpa.info