aravindhrm
New member
- Joined
- Jun 18, 2009
- Messages
- 1
- Programming Experience
- Beginner
Hello friends,
I am doing windows application project in vb.net ,i need help?
code for how to save ,open and print a file /document.
i have used the below code for save but its not working fine.
Dim objSaveFileDialog As New Windows.Forms.SaveFileDialog
With objSaveFileDialog
.DefaultExt =
"doc"
.FileName =
""
.Filter =
"All Files|*.*|BMP Files|*.bmp|JPG Files|*.jpg"
'.Filter = "Word (*.zi) |*.zi;*.rtf|(*.txt) |*.txt|(*.*) |*.*"
.FilterIndex = 1
.OverwritePrompt =
True
.Title =
"Save"
End With
If objSaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
Dim filePath As String
filePath = System.IO.Path.Combine( _
My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
objSaveFileDialog.FileName)
My.Computer.FileSystem.WriteAllText(filePath, Label1.Text, True)
Catch fileException As Exception
End Try
End If
objSaveFileDialog.Dispose()
objSaveFileDialog =
Nothing
I am doing windows application project in vb.net ,i need help?
code for how to save ,open and print a file /document.
i have used the below code for save but its not working fine.
Dim objSaveFileDialog As New Windows.Forms.SaveFileDialog
With objSaveFileDialog
.DefaultExt =
"doc"
.FileName =
""
.Filter =
"All Files|*.*|BMP Files|*.bmp|JPG Files|*.jpg"
'.Filter = "Word (*.zi) |*.zi;*.rtf|(*.txt) |*.txt|(*.*) |*.*"
.FilterIndex = 1
.OverwritePrompt =
True
.Title =
"Save"
End With
If objSaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
Dim filePath As String
filePath = System.IO.Path.Combine( _
My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
objSaveFileDialog.FileName)
My.Computer.FileSystem.WriteAllText(filePath, Label1.Text, True)
Catch fileException As Exception
End Try
End If
objSaveFileDialog.Dispose()
objSaveFileDialog =
Nothing