Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27208

Very basic issue not making much sense...

$
0
0
Hey VB forums..

So I've recently been doing some basic VB programming and I've run into a little bit of a problem when it came to my greeting program.
Essentially what my program does is allow for my input and checks it against pre-determined commands(strings)...

Although after defining few of my strings I came to the realization that only one of them worked... No matter that executable I was trying to run from this string, it worked, but not from the others...

Code:

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged


        Dim game(0 To 1) As String
        game(0) = "play csgo"
        game(1) = "play css"

        Dim program(0 To 5) As String
        program(0) = "launch chrome"
        program(1) = "launch steam"
        program(2) = "launch teamspeak"
        program(3) = "commands"

 



        If TextBox1.Text = program(0) Then Process.Start("chrome.exe")
        TextBox1.Clear()
        If TextBox1.Text = program(1) Then Process.Start("steam.exe")
        TextBox1.Clear()
        If TextBox1.Text = program(2) Then Process.Start("ts3client_win64.exe")
        TextBox1.Clear()
        If TextBox1.Text = program(3) Then Process.Start("cmd.exe")
        TextBox1.Clear()

        If TextBox1.Text = game(0) Then Process.Start("C:\Program Files(x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo.exe")
        TextBox1.Clear()



        RadioButton1.Checked = False

    End Sub


Anybody have any idea why program(0) is the only working string?

Viewing all articles
Browse latest Browse all 27208

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>