Google Answers Logo
View Question
 
Q: Printing vb listbox and option buttons.. ( Answered,   0 Comments )
Question  
Subject: Printing vb listbox and option buttons..
Category: Computers > Programming
Asked by: mrfony-ga
List Price: $10.00
Posted: 18 Mar 2003 12:15 PST
Expires: 17 Apr 2003 13:15 PDT
Question ID: 177817
Hello,

I'm trying to have this vb program print what the user selects on the
main frame
there are to option buttons one is nonfiction the other fiction I have
two dropdown list that the user can select from one is for the subject
the other for the shelf number. I'm having trouble making it work so
it prints the selection the user selects any help would be great.

Printer.Print "Your Selection"
Printer.Print

If optnofiction.Value = True Then
Printer.Print "Non Fiction:", optnofiction.Value

If optfiction.Value = True Then
    Printer.Print "Fiction:", optfiction.Value
 
  If cbosubject.ListCount <> -1 Then
    Printer.Print "Subject:", cbosubject.Text

If lstshelfnum.ListIndex <> -1 Then
    Printer.Print "Shelf Number:", lstshelfnum.Text
Printer.Print

End If

Printer.EndDoc

Request for Question Clarification by hammer-ga on 18 Mar 2003 12:53 PST
Which version of VB?

- Hammer
Answer  
Subject: Re: Printing vb listbox and option buttons..
Answered By: hammer-ga on 18 Mar 2003 13:46 PST
 
mrfony,

Here is an example of a VB6 routine that prints the value selected in
a combo box. It also conditionally prints text for selected option
buttons. Please ask for clarification if you need further
instructions.

Private Sub Command1_Click()
Dim strChoice As String

    If cboSubject.ListIndex > -1 Then
        strChoice = cboSubject.List(cboSubject.ListIndex)
        Printer.Print strChoice
    End If

    If optNonfiction.Value = True Then
        Printer.Print "Nonfiction: True"
    End If

    If optFiction.Value = True Then
        Printer.Print "Fiction: True"
    End If

    Printer.EndDoc

End Sub

Additional Resources:
After pasting this code into your module, place your cursor in the
word List and press F1 for Help on the List property of ListBoxes.

- Hammer
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy