[VB 2005] Making your app choose multiple options.

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Kurroda





Posts: 1737
Joined: Sat Sep 03, 2005 10:01 am
Contact:

[VB 2005] Making your app choose multiple options.

Post 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
Image
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post 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:
Kurroda





Posts: 1737
Joined: Sat Sep 03, 2005 10:01 am
Contact:

Post by Kurroda »

um did you mean Me.Close()
Image
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post by dos mes »

Ummm no. I meant Close()
modder4321





Posts: 118
Joined: Wed Mar 30, 2005 5:35 pm

Post by modder4321 »

Dos Mes wrote:Ummm no. I meant Close()
in vb.net2005 its me.Close()
Kurroda





Posts: 1737
Joined: Sat Sep 03, 2005 10:01 am
Contact:

Post by Kurroda »

hey dont worry bout it we talked on aim
Image
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post 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:
lonestar888





Posts: 22
Joined: Fri Feb 03, 2006 4:23 pm

Post 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
Kurroda





Posts: 1737
Joined: Sat Sep 03, 2005 10:01 am
Contact:

Post 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.
Image
User avatar
LuxuriousMeat





Posts: 824
Joined: Thu Nov 03, 2005 6:43 pm
Location: zzzzzzzzzzzzzzzz
Contact:

Post by LuxuriousMeat »

thats right royals code works
Image
Trigger_six




Connoisseur

Posts: 581
Joined: Wed Dec 07, 2005 3:16 pm
Location: You stalkers... I aint tellin you shizzle :P

Post 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:
User avatar
dos mes





Posts: 2158
Joined: Thu Dec 29, 2005 9:58 pm
Location: Syracuse, NY

Post by dos mes »

Or this

Code: Select all

End
Post Reply