I am trying to have an AND done between two numbers...
I expose the whole problem.
I have a ToolBar with some buttons. The buttons are by itself indexed.
My function must enable/disable the buttons due to the numerical value which I pass to him.
The value is one and contains all the buttons to be enabled, it is a series of bits converted in decimal.
The AND must be done between this value and a mask of bits, which changes at second of the button which I am verifying.
If returns the masks ( in decimal ) then the button will be enabled, otherwise it will be disabled.
Afterwards the code:
The C# does not accept that the AND is done between two numbers, of any kind ... Is it normal?
I expose the whole problem.
I have a ToolBar with some buttons. The buttons are by itself indexed.
My function must enable/disable the buttons due to the numerical value which I pass to him.
The value is one and contains all the buttons to be enabled, it is a series of bits converted in decimal.
The AND must be done between this value and a mask of bits, which changes at second of the button which I am verifying.
If returns the masks ( in decimal ) then the button will be enabled, otherwise it will be disabled.
Afterwards the code:
Code:
public void abilita(long mint)
{
for(int i=0;i<toolbarMain.Buttons.Count;i++)
{
if((mint && Math.Pow(2,i))==Math.Pow(2,i))
{
toolbarMain.Buttons[i].Enabled = true;
}
else
{
toolbarMain.Buttons[i].Enabled = false;
}
}
}
The C# does not accept that the AND is done between two numbers, of any kind ... Is it normal?