MFC Browse Button

Posted on 2010-01-05
Last Modified: 2013-12-14
Does anyone know a simple way to do an MFC Browse button?  Looking for the simplest solution.

The browse button needs to populate a text box next to the button.

help much appreciated.
Using Visual Studio 2008.
Question by:lcor
    LVL 33

    Expert Comment

    What is this MFC Browse button?
    An edit box and a button, the button calls the open file dialog?
    LVL 43

    Expert Comment

    Browse for what ?
    LVL 49

    Assisted Solution

    Latest version of MFC has one that does it automatically:
    MFC Feature Pack for VS 2008 and 2010
    LVL 8

    Assisted Solution

    by:Pramod Bugudai
    What I think is, you are asking for browse for open file dialog(file browser dialog) when a button name browse is clicked. And what you select from the browser dialog it should return the path of file or folder in the text box. If this is the case than follow the link.

    Author Comment

    yes, browse for a file...
    LVL 8

    Expert Comment

    by:Pramod Bugudai
    Than wats the problem? Go ahead what is said.

    LVL 19

    Accepted Solution

    You can do the following:
    void CYourDlg::OnBnClickedBrowse()
    	CFileDialog dlg( TRUE );
    	if ( dlg.DoModal() == IDOK )
    		m_strYourEditVariable = dlg.GetPathName();
    		UpdateData( FALSE );

    Open in new window


    Author Closing Comment

    used alb66's solution but found the other 2 solutions informative so gave points

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now