I'm making a console application, but I get the error shown below and I don't understand the problem.
I will be passing command-line arguments like this:
prog.exe 192.168.0.1 80 On
Can someone point out where I went wrong?Code:Imports System Imports System.Text Imports System.Net.Sockets Module Module1 Public Sub Main() Dim arguments As [String]() = Environment.GetCommandLineArgs() Dim ip As String Dim port As String ip = Environment.GetCommandLineArgs(1) port = Environment.GetCommandLineArgs(2) If Environment.GetCommandLineArgs(3) = "On" Then sendRequest("ip, port, 1") <--- underlined and says "Argument not specified for parameter 'port' of 'Private Sub sendRequest(ip As String, port As Integer, val as String) End If If Environment.GetCommandLineArgs(3) = "Off" Then sendRequest("ip, port, 0") <--- underline here too End If End Sub Private Sub sendRequest(ByVal ip As String, ByVal port As Integer, ByVal val As String) Dim tcpClient As New System.Net.Sockets.TcpClient() Try 'Connect to device tcpClient.Connect(ip, port) If tcpClient.Connected Then ...


Reply With Quote

