Hi ,,,

I need your help plz...

i have programed a calculator and i have an On\Of button .

when the user click On\Off button i want to disable all buttons i have except On\Of button, But also I need to enable all buttons when the user click it again.

and i do not want to use any decision constructs.

i need ur help as soon as possible plz ..


i am beginner in VB

Thank you

If I am understanding correctly, this might help you.

Disables a Button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button2.Enabled = false
    End Sub

Enables a button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button2.Enabled = True
    End Sub

If not let me know. :)

thank you for fast replaying ..

i think i will need to make my question clear .

Private Sub btnOnOF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOnOF.Click
        btnAddition.Enabled = False
        btnDivision.Enabled = False
        btnEq.Enabled = False
        btnSubtruction.Enabled = False
        btnMod.Enabled = False
        btnSqrRoot.Enabled = False
        btnMultiplication.Enabled = False
        btnMRec.Enabled = False
        btnMSt.Enabled = False
        txtFstNum.Enabled = False
        txtOutput.Enabled = False
        txtSecNum.Enabled = False

    End Sub

at this moment i have disable all the buttons except On\Of button ..

and now i need to enable them when the user click on On\of button...

what i should do ..

What I think you might need is an Enable_Change Event. I will try and put something together and try to help you if no one beats me to it.
:)

okay thank you >>


i am waiting your replay..

Dim flag as boolean=False
Private Sub btnOnOF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOnOF.Click
if flag=Flase then
        btnAddition.Enabled = False
        btnDivision.Enabled = False
        btnEq.Enabled = False
        btnSubtruction.Enabled = False
        btnMod.Enabled = False
        btnSqrRoot.Enabled = False
        btnMultiplication.Enabled = False
        btnMRec.Enabled = False
        btnMSt.Enabled = False
        txtFstNum.Enabled = False
        txtOutput.Enabled = False
        txtSecNum.Enabled = False
flag=True
else
        btnAddition.Enabled = True
        btnDivision.Enabled = True
        btnEq.Enabled = True
        btnSubtruction.Enabled = True
        btnMod.Enabled = True
        btnSqrRoot.Enabled = True
        btnMultiplication.Enabled = True
        btnMRec.Enabled = True
        btnMSt.Enabled = True
        txtFstNum.Enabled = True
        txtOutput.Enabled = True
        txtSecNum.Enabled = True
flag=True
end if
    End Sub

I hope it will help you

Thank you for replaying ,,,


But, i want to solve this question without using any decision constructs

Thank you

Dim flag As Boolean = False

Private Sub btnOnOF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOnOF.Click
        btnAddition.Enabled = flag
        btnDivision.Enabled = flag
        btnEq.Enabled = flag
        btnSubtruction.Enabled = flag
        btnMod.Enabled = flag
        btnSqrRoot.Enabled = flag
        btnMultiplication.Enabled = flag
        btnMRec.Enabled = flag
        btnMSt.Enabled = flag
        txtFstNum.Enabled = flag
        txtOutput.Enabled = flag
        txtSecNum.Enabled = flag
        flag = Not flag
    End Sub

I this you want.........I think so

commented: Thank you +1

wowo


Thank you very much prvnkmr194 my problem has been solved

Most Welcome!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.