CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
      #1    
    Old July 18th, 2005, 09:49 AM
    gfr1 gfr1 is offline
    Junior Member
     
    Join Date: May 2002
    Posts: 23
    gfr1 is an unknown quantity at this point (<10)
    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);
    }
    Reply With Quote
      #2    
    Old July 18th, 2005, 11:46 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    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!
    Reply With Quote
      #3    
    Old July 19th, 2005, 06:12 AM
    Andy Tacker Andy Tacker is offline
    More than "Just Another Member"
     
    Join Date: Jun 2001
    Location: 55°50' N 37°39' E
    Posts: 1,503
    Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)
    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();
    __________________
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 10:36 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009