Whats wrong with this code

Posts 1–5 of 5 · Page 1 of 1
Whats wrong with this code
Code:
Private Sub StartFlightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartFlightToolStripMenuItem.Click
        If CloseFlightPlanToolStripMenuItem.Visible = True Then
            MsgBox("Close flight plan first")
        If CloseFlightPlanToolStripMenuItem1.Visible = True Then
            MsgBox("Close flight plan first")
            If CloseFlightPlanToolStripMenuItem2.Visible = True Then
                    MsgBox("Close flight plan first")
                End If
            End If
        End If
    End Sub
My message box never pops up if the menu item is visible.
Any help?
---------
By the way, was there a website reset? I had around 50 posts and all my profile data is gone (Profile pic, avatar, info)
Code:
Private Sub StartFlightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartFlightToolStripMenuItem.Click


If CloseFlightPlanToolStripMenuItem.Visible = 1 Then
MsgBox("Close flight plan first")
End If

If CloseFlightPlanToolStripMenuItem1.Visible = 1 Then
MsgBox("Close flight plan first")
End If

If CloseFlightPlanToolStripMenuItem2.Visible = 1 Then
MsgBox("Close flight plan first")  
End If
    
End Sub
Idk, if this works...
I did just wake up, so maybe I don't see it: code looks good. Did you try setting break points and making sure the function (sub) itself is running?

My guess is that you re-named the tool-strip menu-item and msvs forgot to re-name the code correctly for you ? It generally only changed the "Handles *****" at the very end of the sub decl., maybe check that? COPY the code from {inside} the sub..erase it, double click the menu-item and re-add the code.

edit: or technically the menu item isn't visible? Maybe the menu-item closes before the sub executes? idk the internals of the menu class.

set breakpoints
You just need to put the msgbox. If you click it while its visible, then that button will be visible. If its hidden, you won't be able to click it at all
Yeah. I'm pretty sure the menu technically closes (goes off screen, whatever *), before the sub-routine executes. Apparently. Never used menuitem.visible before
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us