Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't grab value from Edit Box control

Status
Not open for further replies.

khilscher

Programmer
Joined
May 28, 2002
Messages
8
Location
CA
Stupid question, I'm sure. But, I have a single dialog box with an edit box control. When user clicks on a query button, I want to grab that text string and use it in a DNSQuery function. But regardless of what I try, I can't seem to grab the value stored in m_USERID. I have even tried dlg.m_USERID and still nada. I've confirmed the function works fine by hardcoding a FQDN value into it. Here's the code.

void CDDNSTestAppDlg::OnBtnQuery()
{
DNS_STATUS dns_Status;
PDNS_RECORD pDNS_Record;
CString FQDN = m_USERID;

dns_Status = DnsQuery_A (
FQDN,
1,
DNS_QUERY_STANDARD,
NULL,
&pDNS_Record,
NULL
);
}

Any help would be appreciated.

Thanks,

Kevin
 
Did you set up your m_USERID variable with the ClassWizard?

If you did, is it a CEdit control or a CString?

If it's a CString, you have to call UpdateData() before you can try to use its value.
 
Try out GetDlgItemText function to get the text from the edit control.
 
One thing that you might want to try is to call the function UpdateData(TRUE). What this does is that it updates m_USERID with the value that's in the edit control box. If you wish to display the value of m_USERID in your edit control box, you'd call UpdateData(FALSE). Hope that this might be of help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top