-
Jan 30th, 2014, 04:35 PM
#1
Thread Starter
Member
VB2010 windows forms printing question
I have designed a fairly lengthy inquiry form that also has a datagridview of meeting dates, reasons. The customer want to be able to print out the current record with complete meeting data.
The printform control only prints what is visible on the screen, not the entire form or the entire contents of the datagridview of meetings.
I am at a stand still right now and not sure where to go.
Can someone please steer me in the right direction?
Thank you,
Steve Hathaway
-
Jan 30th, 2014, 05:35 PM
#2
Re: VB2010 windows forms printing question
Here's a little something to get you started - taken strait from a production app:
Code:
Private Sub PrintDataViewGrid(ByRef dgv As Windows.Forms.DataGridView, ByVal PrintArgs As Drawing.Printing.PrintPageEventArgs)
Dim linesPerPage As Single = 0
Dim yPos As Single = 0
Dim iThisPageLineCount As Integer = 0
Dim iPos, iTotalColWidth, iColHeaderChars, iAvgColHeaderChars As Integer
Dim leftMargin As Single = PrintArgs.MarginBounds.Left
Dim topMargin As Single = PrintArgs.MarginBounds.Top
Dim itmPrint As Windows.Forms.DataGridViewRow
Dim line As String = Nothing
Dim sngColumnPositions() As Single
Dim sfPlain As Drawing.StringFormat, sfCenter As Drawing.StringFormat
Dim rectLayout As Drawing.RectangleF
Dim FontBold As Drawing.Font
Dim Font As Drawing.Font
'create any string formats and special fonts
Font = dgv.Font
sfPlain = New Drawing.StringFormat
FontBold = New Drawing.Font(Font, Drawing.FontStyle.Bold)
'calculate the number of lines per page.
linesPerPage = PrintArgs.MarginBounds.Height / Font.GetHeight(PrintArgs.Graphics)
'PrintDoc.DefaultPageSettings.Bounds.Height
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
iTotalColWidth += c.Width
iColHeaderChars += c.HeaderText.Length
End If
Next
iAvgColHeaderChars = Int(iColHeaderChars / dgv.Columns.Count)
'determine our column positions
iPos = leftMargin
ReDim sngColumnPositions(dgv.Columns.Count - 1)
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
sngColumnPositions(c.Index) = iPos
iPos += PrintArgs.MarginBounds.Width * (c.Width / iTotalColWidth)
Else
sngColumnPositions(c.Index) = iPos
End If
Next
'add the page header, if any
If Me.m_PageTitle.Length > 0 Then
sfCenter = New Drawing.StringFormat
sfCenter.Alignment = Drawing.StringAlignment.Center
rectLayout = New Drawing.RectangleF(PrintArgs.MarginBounds.Left, PrintArgs.MarginBounds.Top, PrintArgs.MarginBounds.Width, Font.GetHeight(PrintArgs.Graphics) * Me.m_PageTitle.Split(vbCrLf).Length)
PrintArgs.Graphics.DrawString(m_PageTitle, Font, Drawing.Brushes.Black, rectLayout, sfCenter)
iThisPageLineCount += Me.m_PageTitle.Split(CChar(vbCrLf)).Length
End If
'increment one more line to double-space
iThisPageLineCount += 2
'determine our y position for this row
yPos = topMargin + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'yPos = topMargin + dgv.ColumnHeadersHeight
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
If c.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, sngColumnPositions(c.Index + 1) - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
Else
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
End If
sfPlain.LineAlignment = Drawing.StringAlignment.Far
PrintArgs.Graphics.DrawString(c.HeaderCell.Value.ToString, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
'PrintArgs.Graphics.DrawString(c.HeaderCell.Value, fntBold, Drawing.Brushes.Black, sngColumnPositions(c.Index), yPos, sfPlain)
End If
Next
iThisPageLineCount += 1
'print each line of the list.
While iThisPageLineCount < linesPerPage AndAlso m_iPrintIndex < dgv.Rows.Count
'get this item
itmPrint = dgv.Rows(m_iPrintIndex)
'determine our y position for this row
yPos = topMargin + dgv.ColumnHeadersHeight + iAvgColHeaderChars + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'print the cells
For Each c As Windows.Forms.DataGridViewCell In itmPrint.Cells
If c.Visible Then
If System.DBNull.Value.Equals(c.Value) Then
PrintArgs.Graphics.DrawString(String.Empty, Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos, sfPlain)
ElseIf TypeOf c Is Windows.Forms.DataGridViewCheckBoxCell Then
With CType(c, Windows.Forms.DataGridViewCheckBoxCell)
If CBool(.FormattedValue) Then
PrintArgs.Graphics.DrawString("X", Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos + Font.GetHeight(PrintArgs.Graphics), sfPlain)
End If
End With
Else
If c.OwningColumn.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, sngColumnPositions(c.OwningColumn.Index + 1) - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
Else
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
End If
PrintArgs.Graphics.DrawString(c.FormattedValue, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
End If
End If
Next
'increment the print counter
'and persist it to the print index
iThisPageLineCount += 1
m_iPrintIndex += 1
End While
' if more lines exist, print another page.
PrintArgs.HasMorePages = m_iPrintIndex < dgv.Rows.Count
End Sub
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Jan 30th, 2014, 05:41 PM
#3
Re: VB2010 windows forms printing question
Here's a little something to get you started - taken strait from a production app:
Code:
Private Sub PrintDataViewGrid(ByRef dgv As Windows.Forms.DataGridView, ByVal PrintArgs As Drawing.Printing.PrintPageEventArgs)
Dim linesPerPage As Single = 0
Dim yPos As Single = 0
Dim iThisPageLineCount As Integer = 0
Dim iPos, iTotalColWidth, iColHeaderChars, iAvgColHeaderChars As Integer
Dim leftMargin As Single = PrintArgs.MarginBounds.Left
Dim topMargin As Single = PrintArgs.MarginBounds.Top
Dim itmPrint As Windows.Forms.DataGridViewRow
Dim line As String = Nothing
Dim sngColumnPositions() As Single
Dim sfPlain As Drawing.StringFormat, sfCenter As Drawing.StringFormat
Dim rectLayout As Drawing.RectangleF
Dim FontBold As Drawing.Font
Dim Font As Drawing.Font
'create any string formats and special fonts
Font = dgv.Font
sfPlain = New Drawing.StringFormat
FontBold = New Drawing.Font(Font, Drawing.FontStyle.Bold)
'calculate the number of lines per page.
linesPerPage = PrintArgs.MarginBounds.Height / Font.GetHeight(PrintArgs.Graphics)
'PrintDoc.DefaultPageSettings.Bounds.Height
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
iTotalColWidth += c.Width
iColHeaderChars += c.HeaderText.Length
End If
Next
iAvgColHeaderChars = Int(iColHeaderChars / dgv.Columns.Count)
'determine our column positions
iPos = leftMargin
ReDim sngColumnPositions(dgv.Columns.Count - 1)
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
sngColumnPositions(c.Index) = iPos
iPos += PrintArgs.MarginBounds.Width * (c.Width / iTotalColWidth)
Else
sngColumnPositions(c.Index) = iPos
End If
Next
'add the page header, if any
If Me.m_PageTitle.Length > 0 Then
sfCenter = New Drawing.StringFormat
sfCenter.Alignment = Drawing.StringAlignment.Center
rectLayout = New Drawing.RectangleF(PrintArgs.MarginBounds.Left, PrintArgs.MarginBounds.Top, PrintArgs.MarginBounds.Width, Font.GetHeight(PrintArgs.Graphics) * Me.m_PageTitle.Split(vbCrLf).Length)
PrintArgs.Graphics.DrawString(m_PageTitle, Font, Drawing.Brushes.Black, rectLayout, sfCenter)
iThisPageLineCount += Me.m_PageTitle.Split(CChar(vbCrLf)).Length
End If
'increment one more line to double-space
iThisPageLineCount += 2
'determine our y position for this row
yPos = topMargin + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'yPos = topMargin + dgv.ColumnHeadersHeight
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
If c.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, sngColumnPositions(c.Index + 1) - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
Else
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
End If
sfPlain.LineAlignment = Drawing.StringAlignment.Far
PrintArgs.Graphics.DrawString(c.HeaderCell.Value.ToString, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
'PrintArgs.Graphics.DrawString(c.HeaderCell.Value, fntBold, Drawing.Brushes.Black, sngColumnPositions(c.Index), yPos, sfPlain)
End If
Next
iThisPageLineCount += 1
'print each line of the list.
While iThisPageLineCount < linesPerPage AndAlso m_iPrintIndex < dgv.Rows.Count
'get this item
itmPrint = dgv.Rows(m_iPrintIndex)
'determine our y position for this row
yPos = topMargin + dgv.ColumnHeadersHeight + iAvgColHeaderChars + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'print the cells
For Each c As Windows.Forms.DataGridViewCell In itmPrint.Cells
If c.Visible Then
If System.DBNull.Value.Equals(c.Value) Then
PrintArgs.Graphics.DrawString(String.Empty, Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos, sfPlain)
ElseIf TypeOf c Is Windows.Forms.DataGridViewCheckBoxCell Then
With CType(c, Windows.Forms.DataGridViewCheckBoxCell)
If CBool(.FormattedValue) Then
PrintArgs.Graphics.DrawString("X", Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos + Font.GetHeight(PrintArgs.Graphics), sfPlain)
End If
End With
Else
If c.OwningColumn.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, sngColumnPositions(c.OwningColumn.Index + 1) - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
Else
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
End If
PrintArgs.Graphics.DrawString(c.FormattedValue, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
End If
End If
Next
'increment the print counter
'and persist it to the print index
iThisPageLineCount += 1
m_iPrintIndex += 1
End While
' if more lines exist, print another page.
PrintArgs.HasMorePages = m_iPrintIndex < dgv.Rows.Count
End Sub
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Jan 30th, 2014, 05:43 PM
#4
Re: VB2010 windows forms printing question
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jan 30th, 2014, 05:43 PM
#5
Re: VB2010 windows forms printing question
Here's a little something to get you started - taken strait from a production app:
Code:
Private Sub PrintDataViewGrid(ByRef dgv As Windows.Forms.DataGridView, ByVal PrintArgs As Drawing.Printing.PrintPageEventArgs)
Dim linesPerPage As Single = 0
Dim yPos As Single = 0
Dim iThisPageLineCount As Integer = 0
Dim iPos, iTotalColWidth, iColHeaderChars, iAvgColHeaderChars As Integer
Dim leftMargin As Single = PrintArgs.MarginBounds.Left
Dim topMargin As Single = PrintArgs.MarginBounds.Top
Dim itmPrint As Windows.Forms.DataGridViewRow
Dim line As String = Nothing
Dim sngColumnPositions() As Single
Dim sfPlain As Drawing.StringFormat, sfCenter As Drawing.StringFormat
Dim rectLayout As Drawing.RectangleF
Dim FontBold As Drawing.Font
Dim Font As Drawing.Font
'create any string formats and special fonts
Font = dgv.Font
sfPlain = New Drawing.StringFormat
FontBold = New Drawing.Font(Font, Drawing.FontStyle.Bold)
'calculate the number of lines per page.
linesPerPage = PrintArgs.MarginBounds.Height / Font.GetHeight(PrintArgs.Graphics)
'PrintDoc.DefaultPageSettings.Bounds.Height
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
iTotalColWidth += c.Width
iColHeaderChars += c.HeaderText.Length
End If
Next
iAvgColHeaderChars = Int(iColHeaderChars / dgv.Columns.Count)
'determine our column positions
iPos = leftMargin
ReDim sngColumnPositions(dgv.Columns.Count - 1)
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
sngColumnPositions(c.Index) = iPos
iPos += PrintArgs.MarginBounds.Width * (c.Width / iTotalColWidth)
Else
sngColumnPositions(c.Index) = iPos
End If
Next
'add the page header, if any
If Me.m_PageTitle.Length > 0 Then
sfCenter = New Drawing.StringFormat
sfCenter.Alignment = Drawing.StringAlignment.Center
rectLayout = New Drawing.RectangleF(PrintArgs.MarginBounds.Left, PrintArgs.MarginBounds.Top, PrintArgs.MarginBounds.Width, Font.GetHeight(PrintArgs.Graphics) * Me.m_PageTitle.Split(vbCrLf).Length)
PrintArgs.Graphics.DrawString(m_PageTitle, Font, Drawing.Brushes.Black, rectLayout, sfCenter)
iThisPageLineCount += Me.m_PageTitle.Split(CChar(vbCrLf)).Length
End If
'increment one more line to double-space
iThisPageLineCount += 2
'determine our y position for this row
yPos = topMargin + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'yPos = topMargin + dgv.ColumnHeadersHeight
For Each c As Windows.Forms.DataGridViewColumn In dgv.Columns
If c.Visible Then
If c.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, sngColumnPositions(c.Index + 1) - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
Else
rectLayout = New Drawing.RectangleF(sngColumnPositions(c.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.Index), dgv.ColumnHeadersHeight + iAvgColHeaderChars)
End If
sfPlain.LineAlignment = Drawing.StringAlignment.Far
PrintArgs.Graphics.DrawString(c.HeaderCell.Value.ToString, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
'PrintArgs.Graphics.DrawString(c.HeaderCell.Value, fntBold, Drawing.Brushes.Black, sngColumnPositions(c.Index), yPos, sfPlain)
End If
Next
iThisPageLineCount += 1
'print each line of the list.
While iThisPageLineCount < linesPerPage AndAlso m_iPrintIndex < dgv.Rows.Count
'get this item
itmPrint = dgv.Rows(m_iPrintIndex)
'determine our y position for this row
yPos = topMargin + dgv.ColumnHeadersHeight + iAvgColHeaderChars + iThisPageLineCount * Font.GetHeight(PrintArgs.Graphics)
'print the cells
For Each c As Windows.Forms.DataGridViewCell In itmPrint.Cells
If c.Visible Then
If System.DBNull.Value.Equals(c.Value) Then
PrintArgs.Graphics.DrawString(String.Empty, Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos, sfPlain)
ElseIf TypeOf c Is Windows.Forms.DataGridViewCheckBoxCell Then
With CType(c, Windows.Forms.DataGridViewCheckBoxCell)
If CBool(.FormattedValue) Then
PrintArgs.Graphics.DrawString("X", Font, Drawing.Brushes.Black, sngColumnPositions(c.OwningColumn.Index), yPos + Font.GetHeight(PrintArgs.Graphics), sfPlain)
End If
End With
Else
If c.OwningColumn.Index < sngColumnPositions.Length - 1 Then
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, sngColumnPositions(c.OwningColumn.Index + 1) - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
Else
rectLayout = New Drawing.Rectangle(sngColumnPositions(c.OwningColumn.Index), yPos, PrintArgs.MarginBounds.Right - sngColumnPositions(c.OwningColumn.Index), Font.GetHeight(PrintArgs.Graphics))
End If
PrintArgs.Graphics.DrawString(c.FormattedValue, Font, Drawing.Brushes.Black, rectLayout, sfPlain)
End If
End If
Next
'increment the print counter
'and persist it to the print index
iThisPageLineCount += 1
m_iPrintIndex += 1
End While
' if more lines exist, print another page.
PrintArgs.HasMorePages = m_iPrintIndex < dgv.Rows.Count
End Sub
NOTE: This .net version 2.0 - there may be better ways in newer versions. I know this works, though.
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Feb 7th, 2014, 10:37 AM
#6
Thread Starter
Member
Re: VB2010 windows forms printing question
The examples you are posting, I believe, are strictly for data grid view, my form has a mixture of items on it. I am including an image of it.
The form scrolls down for another 10 controls or so.
Thank you,
Steve
-
Feb 7th, 2014, 10:44 AM
#7
Re: VB2010 windows forms printing question
I apologize - I misread your earlier post. However, the code I posted will give you a place to get started on printing. I don't know that there's a simple solution to what you're looking for. You may just have to code it out. If so, then hopefully when you're done you'll have a nice neat solution to share with the rest of us.
But maybe... Somebody else will chime in with something easier.
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Feb 7th, 2014, 11:16 AM
#8
Re: VB2010 windows forms printing question
As dolot guessed, there is no simple solution.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 7th, 2014, 11:19 AM
#9
Re: VB2010 windows forms printing question
There is a component I wrote called MCLFormPrint that will do pretty much all of this except data grids, which I never got around to doing - however you could add the code from this article to do the data grid part.
I also wrote a short e-book on printing in .NET that should also help.
-
Feb 7th, 2014, 11:26 AM
#10
Re: VB2010 windows forms printing question
There you go... take all of Merion's info and put it together and you'll have a great, all purpose printing control. Then you can post it online for everyone to benefit from... I know I'll download it... nice component to a bag of tricks.
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Feb 7th, 2014, 12:09 PM
#11
Re: VB2010 windows forms printing question
Yup - if you want to use MCLFormPrint as your starting point I can add you as a developer in CodePlex. (Applies to anyone so minded)
-
Feb 7th, 2014, 01:09 PM
#12
Thread Starter
Member
Re: VB2010 windows forms printing question
Yes, I would like that.
Guess I am a little surprised that visual studio didn't already have a simpler way to do this.
Thank you,
Steve
Originally Posted by Merrion
Yup - if you want to use MCLFormPrint as your starting point I can add you as a developer in CodePlex. (Applies to anyone so minded)
-
Feb 7th, 2014, 01:21 PM
#13
Re: VB2010 windows forms printing question
Even in classic VB, printing was a weakness. Not real sure why.
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Feb 7th, 2014, 01:42 PM
#14
Re: VB2010 windows forms printing question
If your going to be printing reports I would suggest using a reporting tool like Reportviewer or Crystal Reports or what meets your needs, there are a lot of different ones. The two I listed are probably the most used and you will be able to find many examples and help.
-
Feb 7th, 2014, 03:46 PM
#15
Thread Starter
Member
Re: VB2010 windows forms printing question
I will be using SSRS for reporting, just need something to print off current record for their paper folder.
Originally Posted by wes4dbt
If your going to be printing reports I would suggest using a reporting tool like Reportviewer or Crystal Reports or what meets your needs, there are a lot of different ones. The two I listed are probably the most used and you will be able to find many examples and help.
-
Feb 7th, 2014, 06:13 PM
#16
Re: VB2010 windows forms printing question
Printing is (quite) difficult but in truth MS could have made it easier with a print designer analogous to the form designer....
-
Feb 7th, 2014, 06:27 PM
#17
Re: VB2010 windows forms printing question
Originally Posted by Merrion
Printing is (quite) difficult but in truth MS could have made it easier with a print designer analogous to the form designer....
A print designer would be a useful tool, but would be difficult to implement because of scrollable controls.
I'd be interested to see that put into practice, + Microsoft might even use it in the next version of VS...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 7th, 2014, 06:53 PM
#18
Re: VB2010 windows forms printing question
For scrollable controls I have settings to either truncate it to fit or start a new page (DataOverflowAction
-
Feb 7th, 2014, 06:54 PM
#19
Re: VB2010 windows forms printing question
If you consider it further there are at least 3 problem areas: datagridviews, listviews, + richtextboxes, all of which are complex printing jobs individually
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 7th, 2014, 07:07 PM
#20
Re: VB2010 windows forms printing question
I haven't had a look at your printing code yet, but I will when I have some free time
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 8th, 2014, 05:58 AM
#21
Re: VB2010 windows forms printing question
Cool. It does do RTF boxes across multiple pages.
-
Feb 8th, 2014, 12:19 PM
#22
Member
Re: VB2010 windows forms printing question
I just posted code about printing tabpages with scroll bars, with some edits the code will also work with you requirements...
http://www.vbforums.com/showthread.p...Please-net-4-5
BR
Phezo
-
Feb 8th, 2014, 03:13 PM
#23
Re: VB2010 windows forms printing question
I will be using SSRS for reporting, just need something to print off current record for their paper folder.
Seems like a perfect little report to learn how to create SSRS reports. It's probably easier and faster to learn than creating a report manually.
-
Feb 10th, 2014, 11:30 AM
#24
Thread Starter
Member
Re: VB2010 windows forms printing question
Can you launch a SSRS report for a particular record? I have only used it on full datasets to date with some filtering parameters.
Thank you,
Steve
Originally Posted by wes4dbt
Seems like a perfect little report to learn how to create SSRS reports. It's probably easier and faster to learn than creating a report manually.
-
Feb 10th, 2014, 12:10 PM
#25
Member
Re: VB2010 windows forms printing question
Originally Posted by shathaway
Can you launch a SSRS report for a particular record? I have only used it on full datasets to date with some filtering parameters.
Thank you,
Steve
Yes you can, google "ssrs report passing parameters" :-)
BR
Phezo
-
Feb 10th, 2014, 03:17 PM
#26
Thread Starter
Member
Re: VB2010 windows forms printing question
I am having problems getting the report to accept it or recognize it.
This is the URL I am using, Report parameter
CandidateID
parameter visibility = hidden
available values = none
default values = none
error = The 'CandidateID' parameter is missing a value
If I do parameter visibility = Internal
I get the following error = Parameter validation failed. It is not possible to provide valid values for all parameters. (rsParameterError)
http://bfufsdbfcrpt1/Reports/Pages/R...&CandidateID=7
should I be using hidden or internal? Any idea on the errors?
Originally Posted by phezo
Yes you can, google "ssrs report passing parameters" :-)
BR
Phezo
-
Feb 10th, 2014, 04:07 PM
#27
Member
Re: VB2010 windows forms printing question
http://www.youtube.com/watch?v=yMyHAg60NPA
Try watching this
This will explain a simple way to setup report parameters, remember you can supply multiple datasources to one report...
BR
Phezo
-
Feb 10th, 2014, 04:49 PM
#28
Thread Starter
Member
Re: VB2010 windows forms printing question
Got it figured out. I needed the server/Reports to be server/reportserver.
The way I was accessing the link(url) wouldn't allow parameters to be passed in.
-
Feb 10th, 2014, 08:16 PM
#29
Member
Re: VB2010 windows forms printing question
Great work...
Glad to see you are progressing :-)
BR
Phezo
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|