- Joined
- Jun 27, 2009
- Messages
- 1
- Reaction score
- 0
Hi all,
this is my first post on your site, so execuse me if I don't give you all the informations.
I've always developed VB 6 Code; now I'm approaching to develop under Studio 2008 and I have some problems to understand the different behaviuor.
For example, I'm trying to develop a simple applications that ask to user a file name to print and after print the contents of it on a printer. A very simple application, as you can see.
I have a form, StpJournIP, that ask the data, and a button to print.
Fine, VS 2008, build a Public Class StpJournIP and inside it puts all the context of the forms (textbox, buttons, ...). My print button name is printbutton.
I've seen on MSDN that to print now you must youse PRINTDOCUMENT.
So I've created this code:
Public Class PrintingExample
Inherits System.Windows.Forms.Form
Private components As System.ComponentModel.Container
Private printbutton As System.Windows.Forms.Button
Private printFont As Font
Private streamToPrint As StreamReader
Private Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.printButton = New System.Windows.Forms.Button()
Me.ClientSize = New System.Drawing.Size(504, 381)
Me.Text = "Print Example"
printButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
printButton.Location = New System.Drawing.Point(32, 110)
printButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat
printButton.TabIndex = 0
printButton.Text = "Print the file."
printButton.Size = New System.Drawing.Size(136, 40)
AddHandler printButton.Click, AddressOf printButton_Click
Me.Controls.Add(printButton)
End Sub
' This is the main entry point for the application.
Public Shared Sub Main()
Application.Run(New PrintingExample())
End Sub
End Class
In the instruction AddHandler, I receive an error:
name printbutton_click not declared.
Because this button is on the form, the relative Sub is on the Class StpJourIP. How to reference it ?
Or I'm doing a very bad work ?
Thanks a lot
Ciao, Gaetano
this is my first post on your site, so execuse me if I don't give you all the informations.
I've always developed VB 6 Code; now I'm approaching to develop under Studio 2008 and I have some problems to understand the different behaviuor.
For example, I'm trying to develop a simple applications that ask to user a file name to print and after print the contents of it on a printer. A very simple application, as you can see.
I have a form, StpJournIP, that ask the data, and a button to print.
Fine, VS 2008, build a Public Class StpJournIP and inside it puts all the context of the forms (textbox, buttons, ...). My print button name is printbutton.
I've seen on MSDN that to print now you must youse PRINTDOCUMENT.
So I've created this code:
Public Class PrintingExample
Inherits System.Windows.Forms.Form
Private components As System.ComponentModel.Container
Private printbutton As System.Windows.Forms.Button
Private printFont As Font
Private streamToPrint As StreamReader
Private Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.printButton = New System.Windows.Forms.Button()
Me.ClientSize = New System.Drawing.Size(504, 381)
Me.Text = "Print Example"
printButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
printButton.Location = New System.Drawing.Point(32, 110)
printButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat
printButton.TabIndex = 0
printButton.Text = "Print the file."
printButton.Size = New System.Drawing.Size(136, 40)
AddHandler printButton.Click, AddressOf printButton_Click
Me.Controls.Add(printButton)
End Sub
' This is the main entry point for the application.
Public Shared Sub Main()
Application.Run(New PrintingExample())
End Sub
End Class
In the instruction AddHandler, I receive an error:
name printbutton_click not declared.
Because this button is on the form, the relative Sub is on the Class StpJourIP. How to reference it ?
Or I'm doing a very bad work ?
Thanks a lot
Ciao, Gaetano