473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Printing in vb.net 2005

I have a form with one RichText Box int it. The lines in this are formatted differently that is, some lines are in bold letters, some are center aligned and also the font size are different. Currently I am using PrintDialog Box and Print Preview Dialog box to print the Contents of the RichText Box. The problem is when I preview the print contents everything will be displayed in a common font and aligned left. Could someone please help me solve this problem
Mar 20 '09 #1
7 1989
tlhintoq
3,525 Expert 2GB
What does the actual print out look like?
Mar 20 '09 #2
@tlhintoq
Actual Data to Print
Heading
Sub Heading

Lines of Text



But it Displays

Heading
Sub Heading
Lines of Text
Mar 20 '09 #3
tlhintoq
3,525 Expert 2GB
So you are saying the actual paper print is matching the PrintPreview on screen: No formatting for alignment or style; all is left and plain??
Mar 20 '09 #4
@tlhintoq
Yes. Could you please tell me how to print along with formatting for alignment and style.
Mar 21 '09 #5
tlhintoq
3,525 Expert 2GB
Could you post:
A) The code you are using to fill the RichTextBox
B) The code you are using to call the PrintPreview
Mar 21 '09 #6
@tlhintoq
I have replaced the richtext box with labels and textboxes. Now I am printing the contents of each control seperately. The code I am using now is below. This works to some extent but the alignment is not proper. Is there any other way of doing this.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Print_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
  2.         Dim Page As String
  3.         Page = Me.Label1.Text
  4.         e.Graphics.DrawString(Page, Label1.Font, Brushes.Black, Me.Label1.Location.X, Me.Label1.Location.Y)
  5.  
  6.         Page = Me.Label2.Text
  7.         e.Graphics.DrawString(Page, Label2.Font, Brushes.Blue, Me.Label2.Location.X, Me.Label2.Location.Y)
  8.  
  9.         Page = Me.TextBox1.Text
  10.         e.Graphics.DrawString(Page, TextBox1.Font, Brushes.Black, Me.TextBox1.Location.X, Me.TextBox1.Location.Y)
  11.  
  12.         e.HasMorePages = False
  13.  
  14.     End Sub
  15.  
Mar 21 '09 #7
Someone please tell me how can I print the contents of different controls in vb.net2005
Mar 23 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: mscir | last post by:
+--------------------------------------------------------------------+ | Printing XML: Why CSS Is Better than XSL | | from the anything-you-can-do-i-can-do-better dept. ...
4
by: Al Jones | last post by:
Well, hopefully that title get someones attention. In this old gwbasic program I've converted I *have* sucessuflly converted it to print to a file and the output is acceptable. From there I have...
5
by: ComputerStop | last post by:
I am attempting to print a datagridview. I have not found any method that works successfully. Has any one been successful with this?
2
by: Teemu | last post by:
I have an application created with VB6 and now I'm converting it to VB 2005. Conversion is not so simple because printing is so much different. In my app I have Timer-component, which is creates...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
1
by: Pascal | last post by:
Hello I would wish to print on a sheet with the A4 format forty calculations which would be generated by the computer. (I had to create a program in vb6 who did that thanks to an additional...
0
by: aleemkhan | last post by:
I am using SQL Server 2005 Local Reports for a web based project. The problem is that the ASP.NET default Web Report Viewer does not have print facility for Local Reports. When the report is...
1
by: steve | last post by:
Hi All Has anybody had experience with printing text and barcodes to Zebra label printers in VB.net 2005 Regards Steve
2
by: pedestrian via SQLMonster.com | last post by:
I wonder is there any way I can turn off the "Documentation Feedback" section of the Books Online at the bottom of the pages... I'm printing some Books Online pages for own reference. Thanks in...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.