I am trying to use PrintPreviewDialog, But the Compiler is not finding the txtDocument.Text. I open a file and then want to printpreview dialog but I get a blue underline error with the ppdPreview.Document = txtDocument.Text
Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPrintPreview.Click
ppdPreview.Document = txtDocument.Text
ppdPreview.ShowDialog()
End Sub
Sub OpenDOcument()
' Use the OpenFileDialog control to get a file name
Dim inputFile As StreamReader
Dim strDocumentName As String
With ofdOpenFile
.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
.Title = "Select a File to Open"
End With
If ofdOpenFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
strDocumentName = ofdOpenFile.FileName
inputFile = File.OpenText(strDocumentName)
txtDocument.Text = inputFile.ReadToEnd
End If
End Sub
Visual Studio Express Editions32
|