I will start by admitting that the print routines used were cut and pasted without really understanding what they do beyond a general haziness.
I was able to adapt the basic structure to get what I need. (as long as it fits on 1 page) :rolleyes:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim prn As New Printing.PrintDocument ‘ Handle the page events AddHandler prn.PrintPage, AddressOf Me.PrintPageHandler ‘ Do the print (Printing handled by the print page handler) prn.Print() ‘ Remove the page handler RemoveHandler prn.PrintPage, AddressOf Me.PrintPageHandler End Sub Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs) ****set up values here**** If RadioButton1.Checked Then args.Graphics.DrawString(“Shaft Radius – All measurements from touch – Button Dia: ” & buttonmm, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 10, 40) args.Graphics.DrawString(“Side Step Rad Val Dia Val”, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 10, 80) args.Graphics.DrawString(buttonmm / 2, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 50, 120) args.Graphics.DrawString(vdist, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 140, 120) args.Graphics.DrawString(vdist * 2, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 230, 120) End If If RadioButton2.Checked Then args.Graphics.DrawString(“Throat Radius – All measurements from touch – Button Dia: ” & buttonmm, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 10, 40) args.Graphics.DrawString(“Side Step Rad Val Dia Val”, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 10, 80) args.Graphics.DrawString(“0”, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 50, 120) args.Graphics.DrawString(vdist, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 140, 120) args.Graphics.DrawString(vdist * 2, New Font(“Arial”, 16, FontStyle.Regular), Brushes.Black, 230, 120) End If x = 0 y = 3 Do x = x + sidemm y = y + 1 ang = System.Math.Asin(x / pathrad) z = System.Math.Cos(ang) * pathrad z = Math.Round(z * 100) / 100 If z < vtdist – buttonmm / 2 Then Exit Do If RadioButton1.Checked Then tstring = Math.Round((x + buttonmm / 2) * 100) / 100 args.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 50, y * 40) tstring = Math.Round((z + buttonmm / 2 – vtdist) * 100) / 100 args.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 140, y * 40) tstring = Math.Round(((z + buttonmm / 2 – vtdist) * 2) * 100) / 100 args.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 230, y * 40) End If If RadioButton2.Checked Then args.Graphics.DrawString(x, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 50, y * 40) tstring = Math.Round((z + buttonmm / 2 – vtdist) * 100) / 100 args.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 140, y * 40) tstring = Math.Round(((z + buttonmm / 2 – vtdist) * 2) * 100) / 100 args.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 230, y * 40) End If Loop End Sub
which works ok unless the loop prints more lines than I have space for on the page.
What I need is code to cause a new page and if not too much of a problem, maybe coding to print the loop output in 2 columns on the page before requiring a new page.
Thanks heaps in advance to anyone willing to help here.