Colour Change

wnen i click button_1, i want form1's background-colour to change from Tan to orange, how would i go about this


Answer this question

Colour Change

  • pajaroblanco




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    me.backcolor = MyOrangeColor


    End
    Sub



     


    Now you could do a toggle of the colors like this



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim Static MyBool as boolean = True

    If MyBool then
        MyBool = False
        me.backcolor = MyOrangeColor
    else
        myBool = True
        me.BackColor = MyTanColor
    End
    Sub


     


  • u332

    yes....those are made up variables


    Dim MyOrangeColor as Color = Color.Orange

    Dim MyTanColor as Color = Color.Tan

  • Tranzparency

    yes


    check properties of groupbox

  • Buckshag

    Exellent:) Although i got 1 error, it says it 'myorangecolor is not declared', any ideas why

  • Ferko04

    Is it possible 2 do the same for a group-box as well

  • Colour Change