CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2006
    Posts
    26

    Resolved window forms in c#

    Hi,
    I have two window forms. In one form I used the treeview control and
    When I click on treeview item then the respective form(another) should be opened in the same window as a control.
    I will be very thankful if you can help me.
    thanks in advanced

  2. #2
    Join Date
    Jan 2007
    Posts
    491

    Re: window forms in c#

    I kind of didn't understand what you're asking here. Do you have 2 forms, and they both have TreeView control? Do you want that once I click an item on the first TreeView the same item will be "clicked" on the another TreeView control (in the second form)?

  3. #3
    Join Date
    Jul 2006
    Posts
    26

    Re: window forms in c#

    What my question is, I have some forms,say 5. In those forms one form say form1, contains the treeview control. If I click an item in the treeview then in the form1 itself, the respective other form should be opened. its means that the other form should be a part of the form1.

  4. #4
    Join Date
    May 2007
    Posts
    1,546

    Re: window forms in c#

    A form *is* a window. I don't believe you can open a window inside a window as you describe.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  5. #5
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: window forms in c#

    still not sure we understand exactly what you are asking rajeswaridevi, but i'll take a stab at it...

    are you basically saying:

    Form1 contains a Tree View Control...
    User clicks the 3rd Node in the Tree View.
    Form3 then appears as a new active form/window.
    And Form1 closes?

  6. #6
    Join Date
    Jan 2007
    Posts
    491

    Re: window forms in c#

    Quote Originally Posted by Mutant_Fruit
    A form *is* a window. I don't believe you can open a window inside a window as you describe.
    It is possible. It called MDI or something. There's an option on VCS to do that, and some windows are created automaticlly on the main form.

  7. #7
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    Re: window forms in c#

    make form1 and MDI window. forms 2-5 become mdi children. when you click on a node it brings one of forms 2-5 to the top of the mdi children list.


    also (more for mutant fruit), you can add a second form to another form (which makes it look like an mdi window but is not) by creating a second window (inside the first) and setting its parent property to the first form.

  8. #8
    Join Date
    Jul 2006
    Posts
    26

    Re: window forms in c#

    hi mariocatch,
    you are half the way to my question.
    When the user clicks the 3rd node in the treeview, then the form3 should not appear as a new active form, it should appear in the form1 itself (should embedded in the form1 ).
    can we achieve this by using panel control in the form1. That means the respective window( here form3) will be displayed in the panel control area.

  9. #9
    Join Date
    Jul 2006
    Posts
    26

    Re: window forms in c#

    hi mariocatch,
    you are half the way to my question.
    When the user clicks the 3rd node in the treeview, then the form3 should not appear as a new active form, it should appear in the form1 itself (should embedded in the form1 ). Form1 will not be closed.

    can we achieve this by using panel control in the form1. That means the respective window( here form3) will be displayed in the panel control area.

  10. #10
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

  11. #11
    Join Date
    Nov 2002
    Location
    Baby Land
    Posts
    646

    Re: window forms in c#

    You can also use UserControl instead of form if you want something like the visual studio option dialog

  12. #12
    Join Date
    Jul 2006
    Posts
    26

    Re: window forms in c#

    Thank u all for the suggestions.
    My problem is solved by using MDI concept

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured