OK, i am using Microsoft Visual C++ 2005 Express Edition, and am

using the Window Applications part of it (compared to using Command

Prompt to display programs) Now, as for the program, i am making a

password machine that tells users to enter a username and password,

my program will only check the password and if it is the correct

password( )(a blank space) then it will display a message saying you

have logged in, if not it, it will say invalid password. But there is one

error, when i am debugging my program it keeps on coming up with

this: error C2451: conditional expression of type 'void' is illegal

expressions of type void cannot be converted to other types

Here is the part of the code it applies to...

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if( textBox2->Text = " " )
{
label3->Text = "Welcome."; 
}
else
label3->Text = "Invalid UserName or PassWord.";

Please help me on this program..

I am COMPLETELY Stumpted:confused:

Recommended Answers

All 2 Replies

Here is the part of the code it applies to...

if( textBox2->Text = " " )
{

Shouldn't you use a == instead of a single = P.S.
If that doesn't work, then you will have to use a function like strcmp or an equivalent in Managed C++.

thank you alot!
it works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.