Screen print in VB.Net

  • Thread starter Thread starter Bryan Dickerson
  • Start date Start date
Scroll down to the bottom portion of the screen at VBCity and download the
zip file: PrintTheScreen.zip
it has the entire sample program and code there.
james
 
Thanx! I think I found where the problem was--forgot the
PrintDocument1_PrintPage event.

Ok, now if I wanted to turn the print to landscape, how would I modify it?
 
e.PageSettings

Bryan Dickerson said:
Thanx! I think I found where the problem was--forgot the
PrintDocument1_PrintPage event.

Ok, now if I wanted to turn the print to landscape, how would I modify it?
 
Hi CJ,

When you have time, I try to help a colleague from EricJ (a longtime regular
to this newsgroup he says he comes back when he finished is webproject)

This is the code I made as a sample. It needs a button, a tabcontrol and
some tabpages.
It gives an error on the tabcontrol1.tabpages.remove(lambiek(i)) but not
with me.

(Lambiek and Sidonie are here in the Benelux famous comic figures).

Cor

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim lambiek(Me.TabControl1.TabPages.Count - 1) As TabPage
Dim sidonia(Me.TabControl1.TabPages.Count - 1) As String
For i As Integer = TabControl1.TabPages.Count - 1 To 0 Step -1
lambiek(i) = TabControl1.TabPages(i)
sidonia(i) = TabControl1.TabPages.Item(i).name
TabControl1.TabPages.Remove(lambiek(i))
Next
lambiek.Sort(sidonia, lambiek)
For i As Integer = 0 To lambiek.Length - 1
TabControl1.TabPages.Add(lambiek(i))
Next
End Sub
 
Ok, either I'm doing it wrong or it's more than just
"e.PageSettings.Landscape = True" 'cause that didn't work.
 
Cor: I tried it and it works fine but I only tested WinForms...

Alternatively you use RemoveAt(i) rather than Remove(lambiek(i)) which might
work better for him. Also like to set a variable rather than reference
me.tabcontrol.tabpages.count - 1 so multiple times. Here I've just used
..Clear which I do after the sort trying to reduce the amount of time the
tabpages aren't on display.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim tabMax As Integer = (Me.TabControl1.TabPages.Count - 1)

Dim lambiek(tabMax) As TabPage
Dim sidonia(tabMax) As String

For i As Integer = tabMax To 0 Step -1
lambiek(i) = TabControl1.TabPages(i)
sidonia(i) = TabControl1.TabPages.Item(i).name
' TabControl1.TabPages.RemoveAt(i)
Next

lambiek.Sort(sidonia, lambiek)

TabControl1.TabPages.Clear()

For i As Integer = 0 To tabMax
TabControl1.TabPages.Add(lambiek(i))
Next

End Sub
 
Hi Tom,

That RemoveAt did even give with me an error when I click the button for the
second time, so I changed it this way with that delete, but that clear is a
greath idea, I paste it in at the message from EricJ.

Thanks

Cor
 
kevin will try it :)

tnx

ericj

Cor said:
Hi Tom,

That RemoveAt did even give with me an error when I click the button for the
second time, so I changed it this way with that delete, but that clear is a
greath idea, I paste it in at the message from EricJ.

Thanks

Cor
 
Back
Top