Tree View

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CAM

    Tree View

    Hello,

    I am using Visual Basic.Net 2008 and in my main menu form I have a tree view
    in one of the child node I have a code that opens another form.

    Private Sub TreeView1_After Select(ByVal sender As System.Object, ByVal e As
    System.Windows. Forms.TreeViewE ventArgs) Handles TreeView1.After Select

    If e.Node.Name = "NodeUnassigned " Then

    frmUnassigned.S how()

    ElseIf e.Node.Name = "NodeDailyRepor ts" Then

    frmDailyReports .Show()
    End If

    Now the form "NodeUnassigned " and "NodeDailyRepor ts" when pressed does show
    the form, but soon as the form opens the "Main Menu" form appears I really
    want to close the Main Menu form. How can I stop the "Main Menu" open up
    again I just want to open the other form and close the Main Menu form? Does
    anybody knows the code? Thank you in advance.

  • kimiraikkonen

    #2
    Re: Tree View

    On Nov 5, 7:17 am, "CAM" <alex_marti...@ ca.rr.comwrote:
    Hello,
    >
    I am using Visual Basic.Net 2008 and in my main menu form I have a tree view
    in one of the child node I have a code that opens another form.
    >
    Private Sub TreeView1_After Select(ByVal sender As System.Object, ByVal e As
    System.Windows. Forms.TreeViewE ventArgs) Handles TreeView1.After Select
    >
            If e.Node.Name = "NodeUnassigned " Then
    >
                frmUnassigned.S how()
    >
            ElseIf e.Node.Name = "NodeDailyRepor ts" Then
    >
                frmDailyReports .Show()
            End If
    >
    Now the form "NodeUnassigned " and "NodeDailyRepor ts" when pressed does show
    the form, but soon as the form opens the "Main Menu" form appears I really
    want to close the Main Menu form.  How can I stop the "Main Menu" open up
    again I just want to open the other form and close the Main Menu form?  Does
    anybody knows the code?  Thank you in advance.
    You didn't include why and how you open "Main Menu" form, however as
    you want to close Main Menu form when it's opened, so you can loop
    through OpenForms property to determine when the form is opened, then
    use Close() method to close it.

    Again, it's not apparent when and where you want to close it from,
    then use it carefully when you really need to close form because you
    may need it at any time, so another choice would be Hide() method in
    some cases.




    Hope this helps,

    Onur Güzel

    Comment

    Working...