Metode har ikke samme signatur som delegate problemer
Fejlbeskeden:--------------
Method 'Private Sub tryRun(domainController As Object)' does not have the same signature as delegate 'Delegate Sub ThreadStart()'.
kode:
-----------
Module Module1
Sub Main()
Dim dc As String
Dim myThread As New System.Threading.Thread(AddressOf tryRun)
dc = findDC()
Dim dcArray() As String = Split(dc, ":")
dc = Trim(dcArray(1))
tryRun(dc)
While (True)
myThread.Sleep(60000)
tryRun(dc)
End While
End Sub
Private Sub tryRun(ByVal domainController)
Process.Start(domainController + "\notepad.exe")
End Sub
Private Function findDC()
Dim ps As New Process
Dim env As System.Collections.Specialized.StringDictionary
Dim logonServer As String
Dim systemPath As String
systemPath = Environment.SystemDirectory.ToString()
Console.WriteLine(systemPath + "\cmd.exe")
Console.WriteLine(Environment.UserDomainName.ToString())
ps.StartInfo.FileName = "nslookup"
ps.StartInfo.WorkingDirectory = ""
env = ps.StartInfo.EnvironmentVariables
ps.StartInfo.UseShellExecute = False
ps.StartInfo.RedirectStandardOutput = True
ps.StartInfo.RedirectStandardInput = True
ps.StartInfo.RedirectStandardError = True
ps.Start()
logonServer = ps.StandardOutput.ReadLine()
findDC = logonServer
End Function
End Module
