Page 1 of 1

Program parameters/Command Line [VB]

Posted: Tue Aug 09, 2011 9:35 pm
by killman2639
Hey guys i was wondering if you could help me with this:

Code: Select all

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        Dim u As Integer
        Dim cmd As String = Command()

'        If cmd.Contains("-res") Then

            If cmd.Contains("-res(" & i & "," & u & ")") Then
                Me.Width = i
                Me.Height = u
            Else
                MessageBox.Show("Resolution not supported", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                'Me.Close()
            End If
'        End If 'cmd.Contains("-res")
    End Sub
The point of this is get the integer defined before and set the width and height with the new values in the parameter but the If is comparing whether if the numbers entered are the same as the ones declared before. What i want is to make it read the values that the user wrote in the parameter and then send it to the program (like a cin >>) and set the width and height. Ideas? I was thinking about declaring something in the if but will stay wont work.