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
Re: combobox to print preview question
Quote:
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.
:wave:
-Lou