Skip to main content
Also indent the sub declaration so it's formatted as code.
Source Link
Craig
  • 2.4k
  • 1
  • 21
  • 24

In VB.NET Button click event I am unable to set Visible = true. In all examples in the code below the Control visible property is set to False although the code is setting it to True? Does anyone know how to fix this. I tried setting all parent controls to visible.

Public Sub btnReports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReports.Click If Not IsAllowed(_contextAppUser, btnReports) Then Exit Sub End If ToggleMenuButtonSelection(btnReports, "idec_mainmenu_button") RememberMenuSelection(Me, btnReports, (New StackFrame).GetMethod()) InitializeReportsView()

Public Sub btnReports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReports.Click
    If Not IsAllowed(_contextAppUser, btnReports) Then
        Exit Sub
    End If
    ToggleMenuButtonSelection(btnReports, "idec_mainmenu_button")
    RememberMenuSelection(Me, btnReports, (New StackFrame).GetMethod())
    InitializeReportsView()

    Dim Set1 As Boolean = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If


    Dim container As Control
    Dim cntrl As Control = upnlMainMenu.FindControl("tvReportNavigation")
    cntrl.Visible = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If

    If tblcellMainMenu.Visible = False Then
        tblcellMainMenu.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    If mvMainContent.Visible = False Then
        mvMainContent.Visible = Set1
    End If
    If vwReports.Visible = False Then
        vwReports.Visible = Set1
    End If
    If tvTrainerDocs.Visible = False Then
        tvTrainerDocs.Visible = Set1
    End If
    If pnlReportNav.Visible = False Then
        pnlReportNav.Visible = Set1
    End If
    If tvReportNavigation.Visible = False Then
        tvReportNavigation.Visible = Set1
    End If
    If pnlFileListing.Visible = False Then
        pnlFileListing.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    Me.vwReports.Visible = True

Visible should be set to True.

In VB.NET Button click event I am unable to set Visible = true. In all examples in the code below the Control visible property is set to False although the code is setting it to True? Does anyone know how to fix this. I tried setting all parent controls to visible.

Public Sub btnReports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReports.Click If Not IsAllowed(_contextAppUser, btnReports) Then Exit Sub End If ToggleMenuButtonSelection(btnReports, "idec_mainmenu_button") RememberMenuSelection(Me, btnReports, (New StackFrame).GetMethod()) InitializeReportsView()

    Dim Set1 As Boolean = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If


    Dim container As Control
    Dim cntrl As Control = upnlMainMenu.FindControl("tvReportNavigation")
    cntrl.Visible = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If

    If tblcellMainMenu.Visible = False Then
        tblcellMainMenu.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    If mvMainContent.Visible = False Then
        mvMainContent.Visible = Set1
    End If
    If vwReports.Visible = False Then
        vwReports.Visible = Set1
    End If
    If tvTrainerDocs.Visible = False Then
        tvTrainerDocs.Visible = Set1
    End If
    If pnlReportNav.Visible = False Then
        pnlReportNav.Visible = Set1
    End If
    If tvReportNavigation.Visible = False Then
        tvReportNavigation.Visible = Set1
    End If
    If pnlFileListing.Visible = False Then
        pnlFileListing.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    Me.vwReports.Visible = True

Visible should be set to True.

In VB.NET Button click event I am unable to set Visible = true. In all examples in the code below the Control visible property is set to False although the code is setting it to True? Does anyone know how to fix this. I tried setting all parent controls to visible.

Public Sub btnReports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReports.Click
    If Not IsAllowed(_contextAppUser, btnReports) Then
        Exit Sub
    End If
    ToggleMenuButtonSelection(btnReports, "idec_mainmenu_button")
    RememberMenuSelection(Me, btnReports, (New StackFrame).GetMethod())
    InitializeReportsView()

    Dim Set1 As Boolean = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If


    Dim container As Control
    Dim cntrl As Control = upnlMainMenu.FindControl("tvReportNavigation")
    cntrl.Visible = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If

    If tblcellMainMenu.Visible = False Then
        tblcellMainMenu.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    If mvMainContent.Visible = False Then
        mvMainContent.Visible = Set1
    End If
    If vwReports.Visible = False Then
        vwReports.Visible = Set1
    End If
    If tvTrainerDocs.Visible = False Then
        tvTrainerDocs.Visible = Set1
    End If
    If pnlReportNav.Visible = False Then
        pnlReportNav.Visible = Set1
    End If
    If tvReportNavigation.Visible = False Then
        tvReportNavigation.Visible = Set1
    End If
    If pnlFileListing.Visible = False Then
        pnlFileListing.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    Me.vwReports.Visible = True

Visible should be set to True.

Source Link

VB.NET Button Method not setting Visibility to True

In VB.NET Button click event I am unable to set Visible = true. In all examples in the code below the Control visible property is set to False although the code is setting it to True? Does anyone know how to fix this. I tried setting all parent controls to visible.

Public Sub btnReports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReports.Click If Not IsAllowed(_contextAppUser, btnReports) Then Exit Sub End If ToggleMenuButtonSelection(btnReports, "idec_mainmenu_button") RememberMenuSelection(Me, btnReports, (New StackFrame).GetMethod()) InitializeReportsView()

    Dim Set1 As Boolean = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If


    Dim container As Control
    Dim cntrl As Control = upnlMainMenu.FindControl("tvReportNavigation")
    cntrl.Visible = True
    If upnlMainMenu.Visible = False Then
        upnlMainMenu.Visible = Set1
    End If

    If tblcellMainMenu.Visible = False Then
        tblcellMainMenu.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    If mvMainContent.Visible = False Then
        mvMainContent.Visible = Set1
    End If
    If vwReports.Visible = False Then
        vwReports.Visible = Set1
    End If
    If tvTrainerDocs.Visible = False Then
        tvTrainerDocs.Visible = Set1
    End If
    If pnlReportNav.Visible = False Then
        pnlReportNav.Visible = Set1
    End If
    If tvReportNavigation.Visible = False Then
        tvReportNavigation.Visible = Set1
    End If
    If pnlFileListing.Visible = False Then
        pnlFileListing.Visible = Set1
    End If
    If dgFileListing.Visible = False Then
        dgFileListing.Visible = Set1
    End If
    Me.vwReports.Visible = True

Visible should be set to True.