how to display Form2 by click button in Form1
-
Luc Pattyn wrote:
Never has been a problem. We tend to use tools at their most critical setting; and most of the C compilers we used regularly accurately emitted warnings on anything that could be unintentional, such as missing equal signs and empty loop blocks.
I'm not sure what you mean by "missing equal signs". In vs2008 with warnings and errors set to the strictest settings this compiles just fine:
int n = 1; if( n = 2) cout << "now it's two" << endl;
As far as I can remember I have never used a compiler that produce a warning or error on that because in C/C++ it's perfectly valid to evaluate an assignment result as an expression to be non-zero. So if you typo n == 2 into n = 2 you get no warnings or errors but you don't get the intended behavior. However if you do: 2 == n and typo it to 2 = n you get a compiler error. It's your choice and since I don't have to maintain your code I don't really care what you choose.
Hi Mike, Most of my work is done outside the PC and Microsoft arena; I am not very familiar with Visual Studio C++ compilers, if they don't warn you on
if( n = 2)
then that is too bad; a decent compiler knows such statement is valid, hence no error, but probably wrong, hence a warning, which can be disabled as all messages normally have a numeric code, or avoided by writing unambiguous code as inif((n = 2)!=0)...
That is what warnings are all about: pointing your attention at things that might be intentional and correct, and maybe are not. BTW: most compilers also would warn you the condition is always true, making theif
, and when present theelse
part, redundant. :)Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
-
Hi Mike, Most of my work is done outside the PC and Microsoft arena; I am not very familiar with Visual Studio C++ compilers, if they don't warn you on
if( n = 2)
then that is too bad; a decent compiler knows such statement is valid, hence no error, but probably wrong, hence a warning, which can be disabled as all messages normally have a numeric code, or avoided by writing unambiguous code as inif((n = 2)!=0)...
That is what warnings are all about: pointing your attention at things that might be intentional and correct, and maybe are not. BTW: most compilers also would warn you the condition is always true, making theif
, and when present theelse
part, redundant. :)Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
-
yes Form2 is Login or Logoff form. and Form1 is main form, but Form1 not a type of mdiparent form. mmh do u have other way of this "Application.Exit()" ?
You're getting a lot of help here, which is great. But, what you should learn from this is that you need to do some basic study, to understand these VERY basic things. I sure hope no-one is actually going to use this code, the only place you should be in, is a class. And, you should talk to your teacher first, as he can help you better if he knows how stuck you are, and doesn't read other people's code and assume you wrote it.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp