Click here to Skip to main content
16,006,564 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Error sending mail using smtp Pin
Dave Kreskowiak11-Apr-07 14:35
mveDave Kreskowiak11-Apr-07 14:35 
AnswerRe: Error sending mail using smtp Pin
amaneet11-Apr-07 21:00
amaneet11-Apr-07 21:00 
AnswerRe: Error sending mail using smtp Pin
Dave Kreskowiak12-Apr-07 3:45
mveDave Kreskowiak12-Apr-07 3:45 
AnswerRe: Error sending mail using smtp Pin
A*****12-Apr-07 11:42
A*****12-Apr-07 11:42 
QuestionRather Frustrating Issue Pin
Diagathon11-Apr-07 7:38
Diagathon11-Apr-07 7:38 
AnswerRe: Rather Frustrating Issue Pin
Dave Kreskowiak11-Apr-07 7:44
mveDave Kreskowiak11-Apr-07 7:44 
AnswerRe: Rather Frustrating Issue Pin
Code_Doctor16-Apr-07 17:00
Code_Doctor16-Apr-07 17:00 
QuestionPrinting problem Pin
xjamiex9011-Apr-07 4:14
xjamiex9011-Apr-07 4:14 
Hi,

I am new to VB.net and am writing my first little application that will print a series of images from a data grid to a printer (in this a PDF driver).

If it does one page then it works, but I want it to print onto seperate pages, then it either prints the first page spot on, but then nothing else, or just prints the next set of images over the previous ones. I think I have tried all version of HasMorePages but I may just have it in the wrong place....

Any help would be appreciated....

Thanks

Jamie

Private Sub Test_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Test.Click

Try
AddHandler PrintGraphicControl.PrintPage, AddressOf Me.GraphicPrint1
PrintGraphicControl.Print()
Catch ex As Exception
MsgBox("Test Error" & ex.Message)
End Try

End Sub

Private Sub GraphicPrint1(ByVal sender As Object, ByVal e As PrintPageEventArgs)

Dim i As Integer
Dim rCnt As Integer 'row count
Dim cLeft = e.MarginBounds.Left
Dim cTop = e.MarginBounds.Top
Dim pLength = e.MarginBounds.Bottom - e.MarginBounds.Top
Dim iName As String

For i = 1 To DataGridView1.RowCount
rCnt = rCnt + 1
Next

For i = 1 To rCnt
DataGridView1.CurrentCell = DataGridView1(curColumn, i - 1)
iName = imgPath & (DataGridView1.CurrentCell.Value) & ".jpg"
Try
Dim rDest As New RectangleF(cLeft, cTop, 0, 0)
Dim printFont As Font = New Font("Arial", 10, FontStyle.Regular)
If Image.FromFile(iName).Width < e.MarginBounds.Width Then
'-- Set to bitmap size if bitmap is smaller than paper
rDest.Width = Image.FromFile(iName).Width
rDest.Height = Image.FromFile(iName).Height
Else
'-- Set to paper size if bitmap is larger than paper
'-- Scale height to retain proportions
rDest.Width = e.MarginBounds.Width
rDest.Height = CType(rDest.Width * (Image.FromFile(iName).Height / Image.FromFile(iName).Width), Single)
End If

If pLength < cTop + rDest.Height + (3 * printFont.GetHeight(e.Graphics)) Then
cLeft = e.MarginBounds.Left
cTop = e.MarginBounds.Top
e.HasMorePages = True
Else
e.HasMorePages = False
End If

e.Graphics.DrawImage(Image.FromFile(iName), rDest, Image.FromFile(iName).GetBounds(GraphicsUnit.Pixel), GraphicsUnit.Pixel)
'-- Draw timestamp
e.Graphics.DrawString(Now.ToString, printFont, Brushes.Black, rDest.Left, rDest.Top + rDest.Height + printFont.GetHeight(e.Graphics))
cTop = cTop + rDest.Height + (3 * printFont.GetHeight(e.Graphics))
Catch
End Try
Next i

End Sub
AnswerRe: Printing problem Pin
Dave Kreskowiak11-Apr-07 6:26
mveDave Kreskowiak11-Apr-07 6:26 
GeneralRe: Printing problem Pin
xjamiex9011-Apr-07 6:30
xjamiex9011-Apr-07 6:30 
GeneralRe: Printing problem Pin
Dave Kreskowiak11-Apr-07 7:12
mveDave Kreskowiak11-Apr-07 7:12 
QuestionSudden form creation error after no code change Pin
lucjon11-Apr-07 3:17
lucjon11-Apr-07 3:17 
GeneralEdit Pin
lucjon11-Apr-07 3:29
lucjon11-Apr-07 3:29 
GeneralRe: Edit Pin
Dave Kreskowiak11-Apr-07 5:20
mveDave Kreskowiak11-Apr-07 5:20 
AnswerRe: Edit Pin
lucjon12-Apr-07 20:25
lucjon12-Apr-07 20:25 
QuestionAccess Database from Website In vb.net [modified] Pin
Kiran S. S.11-Apr-07 2:48
Kiran S. S.11-Apr-07 2:48 
AnswerRe: Access Database from Website In vb.net Pin
Dave Kreskowiak11-Apr-07 5:18
mveDave Kreskowiak11-Apr-07 5:18 
GeneralRe: Access Database from Website In vb.net Pin
Kiran S. S.11-Apr-07 18:13
Kiran S. S.11-Apr-07 18:13 
GeneralRe: Access Database from Website In vb.net Pin
Dave Kreskowiak12-Apr-07 3:42
mveDave Kreskowiak12-Apr-07 3:42 
GeneralRe: Access Database from Website In vb.net Pin
Kiran S. S.12-Apr-07 18:14
Kiran S. S.12-Apr-07 18:14 
Questionapi problem. Pin
amaneet11-Apr-07 2:34
amaneet11-Apr-07 2:34 
AnswerRe: api problem. Pin
Dave Kreskowiak11-Apr-07 5:14
mveDave Kreskowiak11-Apr-07 5:14 
QuestionHow to copy file from FTP folder Pin
virendra_00711-Apr-07 2:19
virendra_00711-Apr-07 2:19 
AnswerRe: How to copy file from FTP folder Pin
Dave Kreskowiak11-Apr-07 5:06
mveDave Kreskowiak11-Apr-07 5:06 
GeneralRe: How to copy file from FTP folder Pin
virendra_00711-Apr-07 23:36
virendra_00711-Apr-07 23:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.