C# calling forms
-
so in other words you dont know thanks lol
Gregory Bryant wrote:
so in other words you dont know
Look at the icon, man! He's an MVP, dude!
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
in c# i created the first form as a login the second displays a buddy list once you login the first form is hiden using Form1.hide(); now on the second one i have a log out button that i want to close the second form and open the original first form not a new object i have everything done but reopening the first form. thank you if you can help
Since you couldnt help here is how you do it declare a public, static variable of type Form1 just below the Form1 class declaration. I’ve named the variable frm1 public static Form1 frm1 = null; then when you show form2 frm1 = this; this.Visible = false; Form2 frm2 = new Form2(); frm2.Show(); then from form2 you can call Form1.frm1.show(); so thanks for all your help lol
-
Gregory Bryant wrote:
so in other words you dont know
Look at the icon, man! He's an MVP, dude!
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
Another one. What happened to the normal people? They are supposed to run in the millions. :-D
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Another one. What happened to the normal people? They are supposed to run in the millions. :-D
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
Luc Pattyn wrote:
What happened to the normal people?
Ahem, I've barked at the OP a few times :rolleyes:
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
-
Luc Pattyn wrote:
What happened to the normal people?
Ahem, I've barked at the OP a few times :rolleyes:
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
Sorry, I forgot about your daily show... :laugh:
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Sorry, I forgot about your daily show... :laugh:
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
It's okay :laugh:
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
-
Since you couldnt help here is how you do it declare a public, static variable of type Form1 just below the Form1 class declaration. I’ve named the variable frm1 public static Form1 frm1 = null; then when you show form2 frm1 = this; this.Visible = false; Form2 frm2 = new Form2(); frm2.Show(); then from form2 you can call Form1.frm1.show(); so thanks for all your help lol
http://www.codeproject.com/KB/dotnet/passingvaluesbetweenforms.aspx[^] by Colin Mackay could be helpful for you :)
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
-
i am trying to open the first form from the second that does not work i get an error An object reference is required but i dont want to creat a new object and i do not know how to get the orginal object from my second form
-
so in other words you dont know thanks lol
No, in other words, you plainly have no idea what you're doing and should learn some basics before wasting all our time asking questions you don't understand the answer to.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Since you couldnt help here is how you do it declare a public, static variable of type Form1 just below the Form1 class declaration. I’ve named the variable frm1 public static Form1 frm1 = null; then when you show form2 frm1 = this; this.Visible = false; Form2 frm2 = new Form2(); frm2.Show(); then from form2 you can call Form1.frm1.show(); so thanks for all your help lol
Wow - that's some nasty ass code. Can I make a few suggestions: 1 - buy a beginners book before you become more entrenched in the really bad habits that you're currently forming. Otherwise, your code will always suck as much as this code does. 2 - try to use real variable names. form1 and form2 make sense on your first day of coding, they are not workable in a real project Seriously, you come here, ask for help, complain when you get it, and then you're all proud because you found a way that frankly, belongs in the coding horrors forum.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Since you couldnt help here is how you do it declare a public, static variable of type Form1 just below the Form1 class declaration. I’ve named the variable frm1 public static Form1 frm1 = null; then when you show form2 frm1 = this; this.Visible = false; Form2 frm2 = new Form2(); frm2.Show(); then from form2 you can call Form1.frm1.show(); so thanks for all your help lol
That's one seriously bad piece of code. Why do you think yours is better than the solution I posted above? Let's see - I've been in this industry over 20 years, and have extensive experience in developing applications including using patterns to develop robust systems - and you? Well you accept default form names. Nuff said.
Deja View - the feeling that you've seen this post before.
-
I'd like to think it's Most Valuable Professional, but in my case it could be Madly Vocal Pessimist.
Deja View - the feeling that you've seen this post before.
Pete O'Hanlon wrote:
but in my case it could be Madly Vocal Pessimist.
If the award was for that, it would be much easier for me to win one. In fact I would probably have top honors. ;P
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
That's also pretty bad.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
That's one seriously bad piece of code. Why do you think yours is better than the solution I posted above? Let's see - I've been in this industry over 20 years, and have extensive experience in developing applications including using patterns to develop robust systems - and you? Well you accept default form names. Nuff said.
Deja View - the feeling that you've seen this post before.
But look how much code yours is. His is three lines or something, so it MUST be better.....
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
But look how much code yours is. His is three lines or something, so it MUST be better.....
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Thanks for that - that really made me laugh, and I needed it. :laugh:
Deja View - the feeling that you've seen this post before.
-
Luc Pattyn wrote:
What happened to the normal people?
Ahem, I've barked at the OP a few times :rolleyes:
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
Don't worry - I've no doubt that you'll be joining the hallowed ranks soon enough.
Deja View - the feeling that you've seen this post before.
-
Don't worry - I've no doubt that you'll be joining the hallowed ranks soon enough.
Deja View - the feeling that you've seen this post before.
I pretty sure someday :-D Just need to get off my butt and write some articles :-\
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon