locked
Need help. Im new ;-) RRS feed

  • Question

  • Please correct me if im in the wrong place.

    Anyways im new to c# and i like it alot. Ive added what i want etc but here is my problem.   I have one of them ToolStrip menu bars at the top (the blue ones with ability to do drop down)

    Now what do i do so that when a person clicks on one of the menu things it opens another part of the app but not in a new window.   Just so the current window changes to whatever  they clicked on.

    Sorry if thats confusing. Let me know and il try to make it clearer.

    Thanks

    Dan

    Monday, December 18, 2006 2:36 AM

Answers

  • Not sure if this would work for you, but, from your picture I assume you wanted this:

     

    [code]

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void toolStripMenuItem1_Click(object sender, EventArgs e)

    {

    Loadsettings();

    }

    private void Loadsettings()

    {

    label1.Visible = true;

    label1.Text = ("This is where your info could go for your settings.");

    }

    }

    }

    [/code]

    Obviously I had the label1 setting Visible set to false initially so it would not be seen. Then, when the settings menu item is clicked label1.Visible sets to true and shows whatever info.

    Hope that helps some, or at least points you in the right direction.

    Shawn

    Tuesday, December 19, 2006 3:13 PM
  • Hello All.

    killerbambam:

    If I understand you correctly, what you want is for your main form to stay put, with its menu, and simply have the client area of that form switch to whatever content is applicable to the user's menu choice.

    What you can do is layout the content that you want to show for each menu choice as a UserControl, docked in the main form as DockStyle.Fill.  Each UserControl would have whatever buttons, labels, and other controls were appropriate.  In the FormLoad event handler, simply set whichever one you want to be the default to Visible, and that is the one that will show.

    Whenever a user makes a menu selection, set the appropriate UserControl to Visible.

    HTH.

    Tuesday, December 19, 2006 3:18 PM
  • hi, killer

    You'd create a Movie Collection Starter Kit in Visual Studio visual C# and think about it, which has implemented the function you attempted.

    Hope you get it.

    Monday, December 25, 2006 3:53 PM

All replies

  • Hi your requirement is confusing could you kindly make it more clear.
    Monday, December 18, 2006 4:45 AM
  • So what you are saying is you want a drop down and when you choose a value from the drop down you want something like a panel or some other form based tool to be visible or enabled ?
    Monday, December 18, 2006 1:57 PM
  • http://img247.imageshack.us/img247/8090/helphs9.png

    Like that. if that helps.

    I just want it all in one app rather then different parts popping up for each menu.

    Monday, December 18, 2006 3:42 PM
  • I'm not very clear about what you have encountered. Hope it helps: http://en.csharp-online.net/Tool,_Menu,_and_Status_Strips%E2%80%94ToolStrip_Menus

    BR

    Tuesday, December 19, 2006 2:05 AM
  • ok hmm il put it like this.

    the user opens the application and in it see's the menu.

    Main         Accountinfo          Settings

     

    Now when he/she clicks Accountinfo it opens in new window because i am using this code

     

    Accountinfo Account = new Accountinfo();

    Account.ShowDialog();

     

    but it opens in a new window as i said. I want it so when you click it instead of new window poping up it just changes in the current window.

     

    Hope that is clearer.

    Thanks.

     

    Tuesday, December 19, 2006 5:33 AM
  • hi, killer

    You can consider making the current window to hide or collapse after the new dialog shows.

    BR

    Tuesday, December 19, 2006 5:39 AM
  •  Hello Killer,

                        Now this makes it more clearer, what you can do is you can maximise the form whcih opens up as form maximised form whcih will give the effect whcih you want.

                     

                          this.WindowState = FormWindowState.Maximized;

    Regards,

    Bhupendra

    Tuesday, December 19, 2006 7:05 AM
  • Ah that does sound interesting.  How would ido that?

     

    The maximise thing works but thats not what im looking for. I just want 1 dialog to just change to each thing ie settings main etc rather then popup windows.

    Tuesday, December 19, 2006 2:57 PM
  • Not sure if this would work for you, but, from your picture I assume you wanted this:

     

    [code]

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void toolStripMenuItem1_Click(object sender, EventArgs e)

    {

    Loadsettings();

    }

    private void Loadsettings()

    {

    label1.Visible = true;

    label1.Text = ("This is where your info could go for your settings.");

    }

    }

    }

    [/code]

    Obviously I had the label1 setting Visible set to false initially so it would not be seen. Then, when the settings menu item is clicked label1.Visible sets to true and shows whatever info.

    Hope that helps some, or at least points you in the right direction.

    Shawn

    Tuesday, December 19, 2006 3:13 PM
  • Hello All.

    killerbambam:

    If I understand you correctly, what you want is for your main form to stay put, with its menu, and simply have the client area of that form switch to whatever content is applicable to the user's menu choice.

    What you can do is layout the content that you want to show for each menu choice as a UserControl, docked in the main form as DockStyle.Fill.  Each UserControl would have whatever buttons, labels, and other controls were appropriate.  In the FormLoad event handler, simply set whichever one you want to be the default to Visible, and that is the one that will show.

    Whenever a user makes a menu selection, set the appropriate UserControl to Visible.

    HTH.

    Tuesday, December 19, 2006 3:18 PM
  • Yeah Thanks guys ive taken a different approach using some of the code you have supplied much appreciated.

    Rather then keep posting is there part of the site that displays al the functions etc like what code to put to close the app etc because im not sure how to do it so when the user clicks on the button that says "close" (not the one in the top right corner) it closes the window.

    If it makes it easier if you have msn could you add me.  killerchocolate@hotmail.com (not email as i dont use that) and then talk or help me via that.

     

    Thanks and you guys have helped me alot.

    Tuesday, December 19, 2006 7:14 PM
  • hi, killer

    You'd create a Movie Collection Starter Kit in Visual Studio visual C# and think about it, which has implemented the function you attempted.

    Hope you get it.

    Monday, December 25, 2006 3:53 PM