|
-
Feb 7th, 2007, 12:43 PM
#1
Thread Starter
Junior Member
combobox to print preview question
i am having trouble creating a command which will allow me to will display a print preview of all or individually selected items in my combo box. the only thing i get when i run the program is a blank print preview with nothing on it from the combo box. could someone please get me on the right road?? this is what my code looks like in my form:
Private Sub PrintSubjectsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintSubjectsToolStripMenuItem1.Click
'begin the process for print the subject items.
With Me
If .subjectComboBox.SelectedIndex = -1 Then
'select (none) if nothing selected.
.subjectComboBox.SelectedIndex = 0
End If
If .subjectComboBox.SelectedIndex <> -1 Then
' items selected.
.PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Else
'no item selected
MessageBox.Show("select a item from the book list", _
"print selection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With
End Sub
Last edited by huey; Feb 7th, 2007 at 01:00 PM.
-
Feb 7th, 2007, 12:55 PM
#2
Re: combobox to print preview question
 Originally Posted by huey
i am having trouble creating a command which will allow me to will display a print preview of all or individually selected items in my combo box. the only thing i get when i run the program is a blank print preview with nothing on it from the combo box. could someone please get me on the right road?? this is what my code looks like in my form:
Private Sub PrintSubjectsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintSubjectsToolStripMenuItem1.Click
Code:
VB Code:
With Me
If .subjectComboBox.SelectedIndex = -1 Then
'select (none) if nothing selected.
.subjectComboBox.SelectedIndex = 0
End If
If .subjectComboBox.SelectedIndex <> -1 Then
' items selected.
.PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Else
'no item selected
MessageBox.Show("select a item from the book list", _
"print selection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With
Thats interesting.
You have [CODE] [VBCODE]code here[/VBCODE][/CODE]
and it scrunched up your code.
Perhaps you could drop your [CODE][/CODE] Tags?
Then it would look like this:
VB Code:
With Me
If .subjectComboBox.SelectedIndex = -1 Then
'select (none) if nothing selected.
.subjectComboBox.SelectedIndex = 0
End If
If .subjectComboBox.SelectedIndex <> -1 Then
' items selected.
.PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Else
'no item selected
MessageBox.Show("select a item from the book list", _
"print selection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With
Also, you might want to talk to Hack about moving this into the VBNet area.
-Lou
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
|