I am trying to work with two radio buttons in a simple VB.net app that allows a user to select and open a PDF using the Process object. One PDF will be assigned to each radio button. The code is shown below. I get the following error: "Argument not specified for parameter ‘AFileName’ of ‘Public Sub OpenFile(AFileName As String)."
Please help resolve the error.
This is not homework for a class. It is self-study using books.
Code:
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 SubEnd Class
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 SubEnd Class