TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hemraj Rav
NA
37
3.5k
How to control somepages functionality of printer in vb.net
Sep 29 2017 7:10 AM
Hi Everyone,
I have a serious problams that I have to print word document using vb in desktop not dotnet.
but issues is printing whole pages.
1. control over custom pages -. ex. - if we document has 40 pages and have to print page no. 3,7,9 there are three pages 3,7,9 and these should be print but printer printing whole pages Their is no control that is wrong.
I am using below code -
Dim printer As String = ""
Dim startInfo As ProcessStartInfo
PrintDialog1.Document = PrintDocument1
If PrintDialog1.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then
printer = PrintDialog1.PrinterSettings.PrinterName
End If
startInfo = New ProcessStartInfo("C:\DMS\DMS" & sUserID & ".doc")
With startInfo
.WindowStyle = ProcessWindowStyle.Normal
.Verb = "PrintTo"
.Arguments = """" & printer & """"
.CreateNoWindow = False
.UseShellExecute = True
End With
Try
System.Diagnostics.Process.Start(startInfo)
Me.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
I try below code also but its not working.
PrintDialog1.AllowSomePages = True
PrintDialog1.Document.PrinterSettings.PrintRange = Printing.PrintRange.SomePages
PrintDialog1.Document.PrinterSettings.FromPage = 3
PrintDialog1.Document.PrinterSettings.ToPage = 5
printer = PrintDialog1.PrinterSettings.PrinterName
PrintDialog1.Document.Print()
Thanks in advance
Regards
Hemraj
Reply
Answers (
1
)
Application that will open in 5 different web browsers
How to apply insertion sort in from two sorted arrays?