6 Replies - 1367 Views - Last Post: 24 October 2011 - 07:55 AM Rate Topic: -----

#1 elos1977  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 15-October 10

How to create new menus from button click

Posted 21 September 2011 - 09:58 AM

Hello!

I'm trying to create a database application that has many tables with subtypes.
I'm only beginning to create the GUI, but i'm stuck in the most ridiculous part of it: I have a menu that has 4 options: New, Find, Update and Delete.
I divided the windows form with the split container, so that i could have on the left side the buttons and in the right side the options for each button i.e: "New" has the options "Game", "Accessory" and "Console".
Can anyone help me please?

Thank you!!!

Is This A Good Question/Topic? 0
  • +

Replies To: How to create new menus from button click

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,843
  • Joined: 02-June 10

Re: How to create new menus from button click

Posted 21 September 2011 - 10:04 AM

So what exactly is it you want help with, I'm lost?

You want help making buttons... or a menu?

button demo = new button();
demo.Text = "example";
demo.Location = new Point(15, 30);


And so on.

If you look at the form1.designer.cs file you will see how Visual Studio builds all of the controls on your form for you. This is a great way to learn how they are built and added to a form.


Resources, references and suggestions for new programmers. - Updated Sep 2011
Spoiler

Was This Post Helpful? 0
  • +
  • -

#3 elos1977  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 15-October 10

Re: How to create new menus from button click

Posted 21 September 2011 - 12:08 PM

View PosttlhIn`toq, on 21 September 2011 - 10:04 AM, said:

So what exactly is it you want help with, I'm lost?

You want help making buttons... or a menu?

button demo = new button();
demo.Text = "example";
demo.Location = new Point(15, 30);


And so on.

If you look at the form1.designer.cs file you will see how Visual Studio builds all of the controls on your form for you. This is a great way to learn how they are built and added to a form.


Resources, references and suggestions for new programmers. - Updated Sep 2011
Spoiler


Hi tlhIn`toq:

I know how to make a button, but what i still can't figure out is how to make when you click on a button a new pop-up window with new options appears. I have tried to find exactly that procedure in the internet but i haven't had any luck with it.
Example:

click on the "new" button and a new window appears with this options:
-Unique ID automatically generated.
-Name product.
-Type product----> drop-down menu with game, accessory and console options,(this i know how to do),--> In each of this submenus there are many more submenus, etc.

The only thing that i'm stuck in is the part of linking the button to a new window, which i'm pretty sure it's something really easy.

Again thank you for your time!!!
-
Was This Post Helpful? 0
  • +
  • -

#4 pcaddict  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 45
  • Joined: 11-February 09

Re: How to create new menus from button click

Posted 21 September 2011 - 01:07 PM

You need to add a new Windows Form or WPF Window (depending on which you are using) to your project that handles the logic related to adding/modifying or whatever you want to do to your database. Once you have your new form created, you need to create a new instance of the form and display the form using the click event of the button.

The code you need would look similar to this:
private void addButton_Click(object sender, EventArgs e)
{
	AddNewEntryForm anf = new AddNewEntryForm(); // the new instance of your entry form class
	anf.Show(); // you can use ShowDialog here if you want the AddNewEntryForm window to display modally
}



This is a very basic example of how to display a window triggered by a button click. You would probably want to create a new method that handles creating, showing, and handling the DialogResult and call that method from the button click.
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,843
  • Joined: 02-June 10

Re: How to create new menus from button click

Posted 22 September 2011 - 06:15 AM

Given your two pane design I wouldn't make a form.
I would design UserControls instead of forms.
When you click the button, make a new instance of the UserControl and place it in your right side pane.
Was This Post Helpful? 0
  • +
  • -

#6 elos1977  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 15-October 10

Re: How to create new menus from button click

Posted 24 October 2011 - 07:43 AM

View PosttlhIn`toq, on 22 September 2011 - 06:15 AM, said:

Given your two pane design I wouldn't make a form.
I would design UserControls instead of forms.
When you click the button, make a new instance of the UserControl and place it in your right side pane.



Thank you very much for your help!!!!
Was This Post Helpful? 0
  • +
  • -

#7 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 463
  • View blog
  • Posts: 3,171
  • Joined: 12-January 10

Re: How to create new menus from button click

Posted 24 October 2011 - 07:55 AM

think about it like a web site navigation. when you click a link the content changes. Try to implement that in your design by using user.controls.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1