PDA

View Full Version : سوال: چاپ محتوا فرم



karim orooji
یک شنبه 13 بهمن 1387, 16:16 عصر
من در حال درست كرن پرو‍ژه اي كه مربوط به سهامداران است
بطور مثال زماني كه ما از ديتا گريد خود فردي انتخاب كرده مشخصات فرد در texbox ها نمايش داده ميشود.
حالا ما ميخواهيم اطلاعات درون textbox در يك فرم به نام كارت سهام چاپ بشه
با تشكر

masoud.t123
یک شنبه 13 بهمن 1387, 18:15 عصر
Public

Class Form1FriendWithEvents TXTBox1 AsNew TextBox
FriendWithEvents PrintForm1 As Microsoft.VisualBasic.PowerPacks.Printing.PrintFor m
FriendWithEvents BTN AsNew Button
PrivateSub btn_Click(ByVal a AsObject, ByVal b As System.EventArgs) Handles BTN.Click
PrintForm1.Print()
EndSub




PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Me.PrintForm1 = New Microsoft.VisualBasic.PowerPacks.Printing.PrintFor m(Me.components)
Me.PrintForm1.DocumentName = "document"




Me.PrintForm1.Form = Me




Me.PrintForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPrinter
Me.PrintForm1.PrintFileName = Nothing




'Design New Text Box To Form




TXTBox1.Multiline =

True




TXTBox1.Left = 10
TXTBox1.Top = 10
TXTBox1.Height =

Me.Height - 20
TXTBox1.Width = Me.Width - 20
TXTBox1.Text = "This is Sample Code For Test Print Form " & vbCrLf & "Designer : -_- MHM (Ict_Boy_2005@yahoo.com)" & _
vbCrLf & "Publisher WWW.BarnameNevis.ORG"




Me.Controls.Add(TXTBox1)
'Design new Button to form




Me.Height += 100
BTN.Left = 0
BTN.Width = Me.Width
BTN.Top = TXTBox1.Top + TXTBox1.Height
Me.Controls.Add(BTN)
BTN.Height = 100
BTN.Text = "Do Print"




EndSub
EndClass




منبع : سایت برنامه نویس