button of MDImenu can't disenable in VS2008
Posted
by colorlee
on Stack Overflow
See other posts from Stack Overflow
or by colorlee
Published on 2010-04-23T16:10:58Z
Indexed on
2010/04/23
16:13 UTC
Read the original article
Hit count: 292
visual-studio-2008
Hi everyone.
i had just started to learn VB and VS2008 and im doing some system due to my homework.
i made a WELCOME form with a timer, 5s to pass to the next form which called Select. After passed to next form, itll me.visible = false.
Theres 3 buttons on the Select form which call Customer, Staff and Exit. As i had just start, the button Customer will pass to a MDI menu call Customer Menu with a menu strip button called Quotation. Same, Select will me.visible = false when done.
Then a problem occured, i made a Quotation inside the Customer Menu, such as the mdiparent of Quotation is Customer. I expected that the Quotation button will disenable to press after i pressed that button. But i fail to do that. And the code below:
This is the code of MDI menu Customer Menu:
Public Class frmCustomer
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub AboutUsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutUsToolStripMenuItem.Click
Dim frm As New AboutMamatai
AboutMamatai.ShowDialog()
End Sub
Private Sub frmCustomer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
frmQuotation.MdiParent = Me
frmQuotation.Show()
frmQuotation.Dock = DockStyle.Fill
Me.Location = New Point(220, 180)
End Sub
Private Sub QuotationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuotationToolStripMenuItem.Click
frmQuotation.MdiParent = Me
frmQuotation.Show()
frmQuotation.Dock = DockStyle.Fill
End Sub
End Class
This is the code of the form inside the Customer menu:
Public Class frmQuotation
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
frmCustomer.QuotationToolStripMenuItem.Enabled = True
Me.Close()
End Sub
Private Sub frmQuotation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
frmCustomer.QuotationToolStripMenuItem.Enabled = False
End Sub
End Class
When im tryin to solve this problem, i found that the problem may cause of the me.visible = false of the Select form and Welcome form. Becoz when i set the Customer Menu be the first form to run. The problem is not exist.
Is there anyone can help me ?
P.S. I guess if the other two forms code is needed so i post them also
This is the code of WELCOME form :
Public Class frmWELCOME
Private Sub frmWELCOME_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = New Point(270, 210)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Dim frm As New frmSelect
frm.Show()
Me.Visible = False
End Sub
Private Sub btnSkip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSkip.Click
Timer1.Enabled = False
Dim frm As New frmSelect
frm.Show()
Me.Visible = False
End Sub
End Class
This is the code of Select Form:
Public Class frmSelect
Private Sub btnCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustomer.Click
Dim frm As New frmCustomer
frm.Show()
Me.Visible = False
End Sub
Private Sub btnStaff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStaff.Click
Dim frm As New frmStaff
frm.Show()
Me.Visible = False
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
Private Sub frmSelect_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = New Point(390, 250)
End Sub
End Class
© Stack Overflow or respective owner