Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Visual Basics 2012 chapter 9 PC 10 I was working with the code that was presente

ID: 3822111 • Letter: V

Question

Visual Basics 2012 chapter 9 PC 10
I was working with the code that was presented in Programming Challenge 10 and there is an issue with strFilename and ofdOpenFile as they are not defined. Looking for a solution to fix this. Visual Basics 2012 chapter 9 PC 10
I was working with the code that was presented in Programming Challenge 10 and there is an issue with strFilename and ofdOpenFile as they are not defined. Looking for a solution to fix this. Visual Basics 2012 chapter 9 PC 10
I was working with the code that was presented in Programming Challenge 10 and there is an issue with strFilename and ofdOpenFile as they are not defined. Looking for a solution to fix this.

Explanation / Answer

It would appear that you have declared ofdOpenFile as a io.streamreader which would be consistent with the errors messages.

---> ofdOpenFile needs to be of type System.Windows.Forms.OpenFileDialog.

Dim ofdOpenFile as New OpenFileDialog

If ofdOpenFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
   
strDocumentName = ofdOpenFile.FileName
End If

I hope this will help, Thank!