Help with simple if statemant

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

VS 2005 / C++ __gc program / Converted from VS2003

i have a simple statemant in my program:

if(this->txt_MediaDir->Text != "")

txt_MediaDir is a standart singe line textbox. For some reason in my code
this statemant ALWAYS evaluates to "True". Does anyone have any experance or
idea what's could be going on?
 
cnickl said:
VS 2005 / C++ __gc program / Converted from VS2003

i have a simple statemant in my program:

if(this->txt_MediaDir->Text != "")

txt_MediaDir is a standart singe line textbox. For some reason in my
code this statemant ALWAYS evaluates to "True". Does anyone have any
experance or idea what's could be going on?

I'd guess that you're getting an object reference comparison for some some
reason instead of a string comparison. You might try using

if (this->txt_MediaDir->Text->Length > 0)

or

if (!this->txt_MediaDir->Text->Equals(""))

instead.

-cd
 
Back
Top