Public Class Commands Public Sub OpenFile(ByVal AFileName As String) Dim psi As New ProcessStartInfo() psi.UseShellExecute = True psi.FileName = AFileName Process.Start(psi) End Sub End Class
The following code causes the error:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim fileName As String Dim Commands As New Commands If RadioButton1.Checked = True Then fileName = "c:\test_3\johnson.pdf" End If If RadioButton2.Checked = True Then ' Else fileName = "c:\test_3\ross.pdf" End If MessageBox.Show("File name is: " + fileName) Commands.OpenFile() End Sub End Class
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.