hello,
I am having a problem getting all of my items to display correctly. I have a form that has a combobox. When this combobox changes I need to display different items on the form. This is the code to do this but for some strange reason not all items are set to visible.

Public Function clear() As Boolean
        grpDate.Visible = False
        grpDoct.Visible = False
        grpHide.Visible = False
        grpMain.Visible = False
        grpOptions.Visible = False
        grpPatHasIns.Visible = False
        grpSig.Visible = False
        grpZip.Visible = False
        grpInv.Visible = False
        grpInsurance.Visible = False
        grpDur.Visible = False
    End Function
    Private Sub cboReport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboReport.SelectedIndexChanged
        Select Case cboReport.SelectedIndex
            Case 0 'Daily Totals
                clear()
                grpHide.Visible = True
                grpDate.Visible = True
            Case 1 'Daily Prescriptions
                clear()
                grpMain.Visible = True
                grpDate.Visible = True
                txtMainZip.Visible = True
                chkMainShowDirect.Visible = True
            Case 2 'Patient Profile
                clear()
                grpMain.Visible = True
                grpDate.Visible = True
            Case 3 'Patient Info
                clear()
                grpZip.Visible = True
                grpPatHasIns.Visible = True
            Case 4 'Doctor Info
                clear()
                Me.grpZip.Visible = True
            Case 5 'Insurance Analysis
                clear()
                grpDate.Visible = True
                grpInsurance.Visible = True
            Case 6 'Drug Inventory
                clear()
                grpInv.Visible = True
            Case 7 'DUR
                clear()
                grpDur.Visible = True
                grpDate.Visible = True
                grpDoct.Visible = True
            Case 8 'SIG Codes
                clear()
                grpSig.Visible = True
            Case 9 'Current Medications (Refills Available)
                clear()
                grpDate.Visible = True
                grpMain.Visible = True
                chkMainShowSig.Visible = True
                chkMainShowVoid.Visible = True
                lblMainFacility.Visible = False
                lblMainZip.Visible = False
                chkMainShowDirect.Visible = False
                chkMainRphSig.Visible = False
                txtMainFacility.Visible = False
                txtMainZip.Visible = False
            Case 10 'Delivery Ticket
                clear()
                grpDate.Visible = True
                grpMain.Visible = True
                chkMainPatSig.Visible = False
                chkMainShowCost.Visible = True
                chkMainShowPrice.Visible = True
                chkMainqty.Visible = True
                lblMainZip.Visible = False
                lblMainFacility.Visible = True
                txtMainFacility.Visible = True
                chkMainRphSig.Visible = False
                chkMainShowDirect.Visible = False
                chkMainShowSig.Visible = False
            Case 11 'Pickup Ticket
                clear()
                grpMain.Visible = True
                grpDate.Visible = True
                chkMainShowSig.Visible = False
                chkMainShowCost.Visible = False
                chkMainShowPrice.Visible = True
                txtMainZip.Visible = False
                lblMainZip.Visible = False
                chkMainShowVoid.Visible = False
            Case 12 'Refill Compliance
                clear()
                grpDoct.Visible = True
                grpDate.Visible = True
                grpMain.Visible = True
                chkMainShowPrice.Visible = False
                chkMainShowCost.Visible = False
                chkMainShowVoid.Visible = False
                chkMainShowDirect.Visible = False
        End Select
    End Sub

Any ideas and tips are greatly appreciated.

Thanks

Recommended Answers

All 7 Replies

I would guess these are textboxes or labels. If there is no text in them and no border and the backcolor is the same as the form then you will not see anything. Try using a border around them and see if that doesn't solve you problem.

Can you tell specifically, when selecting an item which item(control) is not visible.

I have a groupbox grpmain that will not display. Some other objects are not displaying as well but the main one is the grpmain.

Have you stepped thru the code to see if the visible portion is being executed?

i have stepped through the code. it hits the code to set visible = true but after continuing and i mouse over the visibility is still set to false. very odd.

I just ran your code. All the group boxes showed up like they should. I did see that you are hiding some controls in places in your code and not showing them again. Click on "Daily Pescription" and you will see all the controls (textboxes, labels and checkboxes). Now click on "Pickup Ticket" and some of the controls are turned off. Now click on "Daily Pescription" and then ones turned off in "Pickup Ticket" are still turned off. This is inconsistent.
As for the group boxes they do turn on and off as expected.
You might have to reinstall vb.......

commented: appreciate the time you put into this to help. thanks +1

i havent really went as far as displaying everything as its needed. I have ran into this problem of the main grp not displaying correctly. without that group there isnt much else i could really do so i was concentrating on that more then the other items.
i was afraid of the reinstall being the option. thanks for you time in helping with this. I am off to reinstall.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.