Page 1 of 1

[VB 2005] Making your app choose multiple options.

Posted: Fri Apr 07, 2006 3:41 pm
by Kurroda
Alright i just wanted to say i am righting this tutorial because i am bored out of my skull

Okay so you want to make your app choose from multiple option, So we use tht If clause. The If clause is very useful way of doing things, Now for some examples.

Okay make a new form go into code view, type this into the form1_load

Code: Select all

If System.DayOfWeek.Friday Then
            MsgBox("Its Friday")
        Else
            MsgBox("Today Is not friday")

        End If
What that basicly did was if it comes back that today is friday then it will show a message box saying its friday if it comes back false it will say today is not friday.

Another example

Code: Select all

If System.DayOfWeek.Friday Then
            Me.ForeColor = Color.Auqa
        Else
            Me.ForeColor = Color.Blue
        End If
You get the basic idea of that now what i am going to do is use if functions with a track bar to change the opacity of our form so drag a trackbar onto the form and go into the code view of the trackbar and put this code,

Code: Select all

If TrackBar1.Value = TrackBar1.Maximum Then
   Me.Opcacity = "1"

Else
  Me. Opacity = "0." & TrackBar1.Value

EndIf

I hope this helped i may add more examples in of tricks you can do,

Royal

Posted: Sun Apr 09, 2006 10:15 pm
by dos mes
If you want to clean up a simple msg app like this you should add in a

Code: Select all

Close()
at the end of "Form1_load"

The new code would look like this

Code: Select all

If System.DayOfWeek.Friday Then
            MsgBox("Its Friday")
        Else
            MsgBox("Today Is not friday")

        End If
Close()
And the new app will automatically close the main form when opened but leave the message box. Then you dont have to x out of the main form that has nothing on it :wink:

Posted: Mon Apr 10, 2006 7:34 am
by Kurroda
um did you mean Me.Close()

Posted: Mon Apr 10, 2006 8:25 am
by dos mes
Ummm no. I meant Close()

Posted: Wed Apr 12, 2006 2:46 am
by modder4321
Dos Mes wrote:Ummm no. I meant Close()
in vb.net2005 its me.Close()

Posted: Wed Apr 12, 2006 4:26 am
by Kurroda
hey dont worry bout it we talked on aim

Posted: Wed Apr 12, 2006 9:24 pm
by dos mes
And we concluded that either could be used. But in a multiple form application me.close will only close that form so no one was wrong. It's all good. :wink:

Posted: Sun Apr 30, 2006 8:19 am
by lonestar888
The opacity code is wrong.

Like this:

Code: Select all

If TrackBar1.Value = TrackBar1.Maximum Then
  

Else
  Me. Opacity = "0." & TrackBar1.Value

EndIf

Posted: Sun Apr 30, 2006 8:55 am
by Kurroda
my code is not wrong actully yours is, My code returns the opacity value back to 1 while yours doesnt and its still transparent at the maximum value.

Posted: Sat May 06, 2006 11:05 am
by LuxuriousMeat
thats right royals code works

Posted: Thu May 11, 2006 12:18 am
by Trigger_six
Dos Mes wrote:If you want to clean up a simple msg app like this you should add in a

Code: Select all

Close()
at the end of "Form1_load"

The new code would look like this

Code: Select all

If System.DayOfWeek.Friday Then
            MsgBox("Its Friday")
        Else
            MsgBox("Today Is not friday")

        End If
Close()
Or you can do this:

Code: Select all

If System.DayOfWeek.Friday Then
            MsgBox("Its Friday")
        Else
            MsgBox("Today Is not friday")

        End If
Application.Exit
(for VB.Net AKA VB2005 AKA VB8 AKA Visual Basic 2005 Express Edition AKA....................*Jaw snaps in half*
*Whines like a dog*
:wink:

Posted: Thu May 11, 2006 1:29 pm
by dos mes
Or this

Code: Select all

End