p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer (http://p2p.wrox.com/forumdisplay.php?f=574)
-   -   Chapter 13 Try It! (http://p2p.wrox.com/showthread.php?t=82819)

MikersSU March 3rd, 2011 09:19 AM

Chapter 13 Try It!
 
I think the Try It has the form creation steps backwards. The instructions had me creating the NewItem form first but that itself is the form that is called once the Add Item button is clicked on the AddOrderItems form.

Am I going nuts?

Great book by the way. I wish more programming books were structured like this one.

Rod Stephens March 4th, 2011 10:05 AM

Quote:

I think the Try It has the form creation steps backwards. The instructions had me creating the NewItem form first but that itself is the form that is called once the Add Item button is clicked on the AddOrderItems form.

Am I going nuts?
You're not going nuts. I was a bit unclear.

I meant to start a new project and then create the new form. Creating the new project makes the initial main form, which you later give controls. It's not that you can create the Add Item form without making the main form, I just meant to add controls to the Add Item form first.

And you don't really need to do it in that order, either. I just think of the Add Item form as the more interesting one so I focused on it first. You're certainly allowed to build them in either order and in many programs I end up jumping back and forth a bit to tweak one form after working on the other makes me think of something I missed.

Quote:

Great book by the way. I wish more programming books were structured like this one.
Thanks! I'm glad you're finding it useful. Post a review when you have a chance. And let me know if you have other questions or comments.

Joakim December 22nd, 2011 05:09 AM

Quote:

Originally Posted by Rod Stephens (Post 269556)
You're not going nuts. I was a bit unclear.

I meant to start a new project and then create the new form. Creating the new project makes the initial main form, which you later give controls. It's not that you can create the Add Item form without making the main form, I just meant to add controls to the Add Item form first.

And you don't really need to do it in that order, either. I just think of the Add Item form as the more interesting one so I focused on it first. You're certainly allowed to build them in either order and in many programs I end up jumping back and forth a bit to tweak one form after working on the other makes me think of something I missed.



Thanks! I'm glad you're finding it useful. Post a review when you have a chance. And let me know if you have other questions or comments.

I dont't understand:
I did the same mistake as MikerSU and creaded the forms in the wrong order so now when I run the program I end up with the New Item form first.
How do I change the startupsequence so that the first form displayed is the Add Order Items form?

Cheers
/Joakim

Rod Stephens December 22nd, 2011 12:15 PM

When you create a Windows Forms project, by default the initial form it creates is set as the start up form. To change that, open the Project menu and select Properties. Then on the Application tab, open the Startup Form dropdown and select the form that you want to launch when the program starts.

That's all there is to it. It's easy enough if you know where to look.

Joakim December 23rd, 2011 03:21 AM

Quote:

Originally Posted by Rod Stephens (Post 279708)
When you create a Windows Forms project, by default the initial form it creates is set as the start up form. To change that, open the Project menu and select Properties. Then on the Application tab, open the Startup Form dropdown and select the form that you want to launch when the program starts.

That's all there is to it. It's easy enough if you know where to look.

Thank's Rod but that didn't work.
I repeated the try-me and created the frames in the proper order and that works fine but I also wanted to try your work-around.

When I open the application tab from the properties I have a drop-down called 'Startup object' which I guess is the one to use. When I open it I only have two choices '(Not set)' and my projectnamen ending with '_Scope.Program'. I'm not allowed to enter data eighter

Nowhere can I find my alternate frame...

Merry x-mas

Rod Stephens December 23rd, 2011 11:49 AM

Ah, sorry. I was looking at a Visual Basic project.

In C# open the Program.cs file. In the code editor, there should be a line that looks like this:

Code:

Application.Run(new Form1());
That creates a Form1 object and displays it. Just change Form1 to the name of the form that you want to start up with and you should be set.

Joakim December 29th, 2011 05:53 AM

Quote:

Originally Posted by Rod Stephens (Post 279743)
Ah, sorry. I was looking at a Visual Basic project.

In C# open the Program.cs file. In the code editor, there should be a line that looks like this:

Code:

Application.Run(new Form1());
That creates a Form1 object and displays it. Just change Form1 to the name of the form that you want to start up with and you should be set.

Yes, thankyou that did the job for me.[:)]

Rod Stephens December 29th, 2011 10:51 AM

I'm glad you figured it out [;)]

This is actually a little easier in Visual Basic. There you open the project's Property pages (Project > Properties) and on the Application tab you select teh start up form from the "Startup form" drop down.

Ilyaalex March 29th, 2012 10:54 AM

Trying to finish this Try it, but when debug mode passing this
"private void addItemButton_Click(object sender, EventArgs e)
{
NewItemForm dlg = new NewItemForm();
if (dlg.ShowDialog() == DialogResult.OK)" nothing happened.
Watched video several times and read this chapter, but can't figure out where is my mistake?!

Ilyaalex March 30th, 2012 03:19 AM

Any ideas??? What have I missed?


All times are GMT -4. The time now is 10:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.