I want to check if the Text box has some text entered by the user but can't. The statement below always returns false
if (MyLLVTextEdit->getMessage() == NULL)
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
also tried
if (MyLLVTextEdit->getMessage() == "")
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
if (MyLLVTextEdit->getValue() == NULL)
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
if (MyLLVTextEdit->getValue() == "")
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
Any ideas please?
Don't familiar with your library, but you should use strcmp
function to compare strings (char*), to check if string is empty, you may call strlen
strlen(MyLLVTextEdit->getMessage()) == 0
operator==
may be used only if you use some string classes like std::string
QString
or whatever
What does getMessage() return? Very unlikely char*, as Rogue Wave has own unicode-capable string classes.
If it a kind of a Rogue Wave string-class, check if there is a method for testing the content for emptiness.
Probably you should use something like:
if (MyLLVTextEdit->getMessage().isNull() )
or
if (MyLLVTextEdit->getMessage().isEmpty() )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.