I want to convert the ms access data into a document so that the print function in vb.net will read it. Where do I start from here?
Here is my form: http://screencast.com/t/MGU4N2UyNmY
And here is the code for print preview.
Try
PrintPreviewDialog1.ShowDialog()
Catch es As Exception
MessageBox.Show(es.Message)
End Try
How do I incorporate the above code, to the code below so that there is something that can be seen when I hit the print button?
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\search.mdb")
Dim cmd As OleDbCommand = New OleDbCommand("Select * from GH where NAME= '" & TextBox6.Text & "' ", cn)
cn.Open()
Dim rdr As OleDbDataReader
rdr = cmd.ExecuteReader
If rdr.HasRows Then
rdr.Read()
NoAcc = rdr("NAME")
If (TextBox6.Text = NoAcc) Then TextBox1.Text = rdr("IDNUMBER")
If (TextBox6.Text = NoAcc) Then TextBox7.Text = rdr("DEPARTMENT")
If (TextBox6.Text = NoAcc) Then TextBox8.Text = rdr("COURSE")
End If
Please help,thanks
You need a printdocument object/control to use the printing methods in vb.
This object controls what is sent to the printer and can be used for the dialogs eg print preview.
VB
The user simply needs to select a pdf printer for it to be converted to PDF then.
Also why are you using VB.net?
There are features in ms-access that allow you to print a query? eg Forms, Querys, Reports.