CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    32

    Dynamic Edit Control

    i am having a dialog box with two buttons namely
    1 CREATBTN
    2 SHOWBTN

    my request

    1 when i click CREATEBTN, i want to create dynamically edit controls

    2 when i click SHOWBTN, i want to get the text of all the edit controls,

    then show that text as message;


    help me please

  2. #2
    Join Date
    Aug 2002
    Posts
    879

    Re: Dynamic Edit Control

    Code:
    #include <vector>
    std::vector<CEdit*> vedit;
    int id_counter=10000;
    CString str_txt;
    put this on your OnCREATEBTN()
    to create a edit control on every button click
    Code:
       CEdit *ed = new CEdit;
       ed->Create(WS_VISIBLE,CRect(x,y,x2,y2),this,id_counter);
       vedit.push_back(ed);
       ++id_counter;
    you can get the text from a created ctrl this way
    Code:
    vedit[0]->GetWindowText(str_txt);
    Last edited by blueday54555; March 16th, 2005 at 10:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured