Hi have searched and searched but cannot find a specific answer to this..
I have a form with a combobox with a list of PC names.
I want to store the pc name selected as a variable and pass it through to a function.
It fails. I dont understand why. Even if i put up a msgbox to display my variable, it displays empty..
If I switch to using a regular textbox, pass that through to a variable and then onto the function.. it works...
and the function it calls:
Please advise...
I have a form with a combobox with a list of PC names.
I want to store the pc name selected as a variable and pass it through to a function.
It fails. I dont understand why. Even if i put up a msgbox to display my variable, it displays empty..
If I switch to using a regular textbox, pass that through to a variable and then onto the function.. it works...
Code:
Public Sub allianceChecker()
Dim strProcess As String = "ALLIANCEMFG.EXE"
Dim strComputer As String = frmStart.cmbMainFrm_PcList.SelectedText.ToUpper
MessageBox.Show(strComputer)
MessageBox.Show(strProcess)
If CheckRemoteProcess.IsProcessRunning(strComputer, strProcess) = True Then
MessageBox.Show("Yes")
Else
MessageBox.Show("no")
End If
End Sub
Code:
Module CheckRemoteProcess
Public Function IsProcessRunning(ByVal strServer, ByVal strProcess)
Dim Process, strObject
IsProcessRunning = False
strObject = "winmgmts://" & strServer
For Each Process In GetObject(strObject).InstancesOf("win32_process")
If UCase(Process.name) = UCase(strProcess) Then
IsProcessRunning = True
Exit Function
End If
Next
Return IsProcessRunning
End Function
End Module
Please advise...
Comment