| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Passing the address of a textbox
The routine below gets the address of the Edit box that currently has focus and passes that information to a function that checks to see if the text in the control is in the correct format i.e. time(##:##:##.###) This works in MFC how can I do the same thing in a .NET Forms app.
void CConvertDlg::CheckFormat(CString &buff, const int &type) { // This functions gets get the address of the current edit box and // passes that information on to timeformat a libaray routinewhich checks for // correct format CWnd *pWnd; CEdit *Edit; int id; pWnd = GetFocus(); id = pWnd->GetDlgCtrlID(); Edit = (CEdit*)GetDlgItem(id); TimeFormat(Edit,buff,type); UpdateData(FALSE); } |
|
#2
|
||||
|
||||
|
Re: Passing the address of a textbox
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#3
|
|||
|
|||
|
Re: Passing the address of a textbox
NoHero's given a good link...
simply, you create a function and instead to CEdit* you pass TextBox type to function and in return you can set Boolean return value. if(TimeFormat(myTextBox)) GoDoMoreWork(); else ShowErrorMessage(); |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|