I'm trying to start a cmd console and run a command. The command has two points where I need to have user input which is why I have made the string "cmdcode" where it combines preset info and the user input. When the program is ran I get the error code "Object reference not set to an instance of an object." two times, once referring to the whole line where cmdcode is created and once referring to the actual variable "cmdcode" on that same line. What is happening and if there is a different way to do it then how.
Also if anyone knows how to run the "process.start()" command "x" number of times that would be great.
Public Class Form1
Dim cmdcode As String = "ping" + TextBox1.Text + "-t -l" + TextBox2.Text
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub STARTBUTTON_Click(sender As Object, e As EventArgs) Handles STARTBUTTON.Click
Process.Start("CMD", cmdcode)
End Sub
End Class