-
check edit box value
Hi
I'm trying to verify if a edit box has been populated with data by the user. Here is some code:
Code:
void CFtpDlg::OnFtp()
{
if(m_sUser == " ")
{
AfxMessageBox("please enter user name");
return;
}
//rest of code...
}
My problem is that no matter whether the box is empty or not, the message always gets displayed. Oh yeah and I do initialize m_sUser to " " before this function.
-
Well the answer depends on what data type m_sUser is.
If it is a CString that is tied to an edit box (MFC Code), then you need to make sure and call UpdateData() so that m_sUser gets filled with what is in the edit box. Otherwise it will stay at its default value (" " in your case).
-
shot thanx!
I've been messing around with UpdateDate() but I was passing it values (TRUE) & (FALSE). Needles to say it didn't work.
Anyway thanks again.