How to relate the printDocument to the information we want to print
Hello i need some help in finding the way to relate the printDocument to the information i have in a panel control container... please iff anyone can point the way!!!!
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
FroglegRank #1,020 · 1.9K reputationPosted Dec 21, 2010, 1:14 PM EST
You will be probably be using the graphics of printDocument
Jorge Torselli24 reputationPosted Dec 31, 2010, 8:43 AM EST
Thankyu for replying... sorry for my spellig,
Jorge
Jorge Torselli24 reputationPosted Dec 31, 2010, 8:44 AM EST
FroglegRank #1,020 · 1.9K reputationPosted Jan 3, 2011, 10:23 PM EST
If you are still having problems can you post your code
Jorge Torselli24 reputationPosted Jan 4, 2011, 5:48 AM EST
This is the code Im using to print the ritchTextbox, but I still cannot set the paper size in order to make the printer to recognize the margins in the content of the ritchTextBox, Once again thanks...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim printdoc As New PrintDocument
AddHandler printdoc.PrintPage, AddressOf Me.printext
printdoc.Print()
Catch ex As Exception
MessageBox.Show("Error vuelva a intentarlo")
End Try
End Sub
Private Sub printext(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
ev.Graphics.DrawString(RichTextBox1.Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, 60, 300)
End Sub
ev.HasMorePages = False
FroglegRank #1,020 · 1.9K reputationPosted Jan 4, 2011, 5:28 PM EST
ev.Graphics.DrawString(RichTextBox1.Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, 60, 300)
End Sub
In this sub the 60 and 300 are fixed margins so they need to adjustable
There are two types of RichTextBox printing examples in zip file, your's that I modified and another probably better way
Anyway try it and let me know what you think
Jorge Torselli24 reputationPosted Jan 8, 2011, 7:18 AM EST
question...1 i have to declare in the eload event the paper size? yes???
quetstion... 2 i never seen regions and end region would you be kind to explaint to me...
once again thanks.... am new into programing so this is been a great deal for me really thanks...
FroglegRank #1,020 · 1.9K reputationPosted Jan 8, 2011, 9:07 AM EST
Regions are used to group code so that it makes it easier for someone to read, and you can expand / contract a region once that particular code is finished
#Region "Call it whatever"
#End Region
Jorge Torselli24 reputationPosted Jan 10, 2011, 5:12 AM EST
in other word at desing time .....
FroglegRank #1,020 · 1.9K reputationPosted Jan 10, 2011, 9:18 AM EST
The text that appears in my sample loaded automatically so during creating the project - I did not have to continually type in the textbox
to disable the text: comment out loadTxt() ie:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'loadTxt()
RadioButton1.Checked = True
PrintDocument1.DefaultPageSettings.PaperSize = New Printing.PaperSize(("A4 (210 x 297 mm)"), 827, 1169)
End Sub
Jorge Torselli24 reputationPosted Mar 28, 2011, 5:40 PM EDT
login falied for user TYM-01\guest.... and the connection string is these...
Data Source=192.168.1.5\Coatepeque;Initial Catalog=BDKR; user id = jose; password = 123; Integrated Security=True
or i have try these other conection string
Data Source=TYM-01\Coatepeque;Initial Catalog=BDKR; user id = jose; password = T0rs3ll1; Integrated Security=True
if you can see the user id is jose and i dont know why the hell is telling me TYM-01\guest
i have start and enable remote conections in sql instance and enable tcp/ip protocol....
so tell me what you tink ok???
thanks again....
Jorge
FroglegRank #1,020 · 1.9K reputationPosted Mar 29, 2011, 10:04 AM EDT
http://msdn.microsoft.com/en-us/library/bb669065.aspx
Karthikeyan AnbarasanRank #71 · 25.5K reputationPosted Apr 7, 2011, 10:25 PM EDT