|
-
Jan 4th, 2004, 08:01 AM
#1
Thread Starter
Fanatic Member
Printing a Form
I am trying to print a form.
I have tried many things, but it keeps on crashing when i try to bring up the print dialog box.
I would like to print the form-how can i do this by using the print dialog box?
any help please
-
Jan 4th, 2004, 09:02 AM
#2
Sleep mode
-
Jan 4th, 2004, 10:09 AM
#3
Fanatic Member
If your form is based mainly on a dataset (in a datagrid), then you can pretty easily go the GDI+ route, just make a method that parses your datatable(s) and adds rows, columns. The only thing to watch out for is that you have to maintain your own page breaks (column, row states).
-
Jan 5th, 2004, 06:24 AM
#4
Lively Member
this is the code i used to print a letter through .net u need to make a template and insert boomarks where u want the information then save it to a directory then run this code it should work.
this bit opens and prints the form
Dim sPrecedentName As String = (your directory here)
Dim docLetter As Word.DocumentClass
Dim wrdSession As Word.ApplicationClass
Dim i As Int32 = 0
'Open Template
wrdSession = CreateObject("Word.Application")
wrdSession.Visible = False
wrdSession.DisplayAlerts = Word.WdAlertLevel.wdAlertsMessageBox
docLetter = wrdSession.Documents.Open(sPrecedentName, , True, False)
'Populate
Me.ImportBookmarks(docLetter, your parameter here)
'Close Template
wrdSession.ActiveDocument.PrintOut()
While wrdSession.Application.BackgroundPrintingStatus > 0
'Waiting for doc to print
Application.DoEvents()
End While
'Close Document without saving
docLetter.Close(False)
wrdSession.Quit()
this bit inputs the data into the form
Dim bmBookmark As Word.Bookmark
fill your dataset here
With ur dataset
For Each bmBookmark In docLetter.Bookmarks
bmBookmark.Select()
Select Case bmBookmark.Name
Case " bookmark 1"
docLetter.Application.Selection.TypeText(.Item(enter dataset column)
Case "bookmark 2"
same as above
Case "bookmark 3"
same as above
Case "bookmark 4"
same as above
End Select
Next
you have to refence word aswell but this might help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|