dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Function that convert a string to a control

  1. #1
    Join Date
    Aug 2001
    Posts
    60

    Talking Function that convert a string to a control

    I receive a string from user and put it in to CString variable (strUserEnter). Is it possible to create a Button that CButton ojbect is strUserEnter

    CString strUserEnter;//
    ....
    ....
    ....

    CButton *IsThereAnyFunctionInVCpp(strUserEnter); //After this line New button named strUserEnter has declared.

    //Sorry for bad English


    Thank You.

  2. #2
    Join Date
    Oct 2001
    Location
    Dublin, Eire
    Posts
    880
    Try the function SetWindowText:

    Code:
    CButton myButton;
    CString str("Button name");
    myButton.SetWindowText(str);
    Elrond
    A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
    -- George Steiner

  3. #3
    Join Date
    Nov 2002
    Location
    India
    Posts
    60
    i think u want to craete a button at run time which i think is not possible in vc++(i am not confirmed) but the possible solution for ur problem could that u can take a button which is intiallly hidden but after getting the string from the user u can set its visible property to true and and set that string as caption of the control.

    i hope this will help u to solve the immediate problem

    ALL THE BEST

  4. #4
    Join Date
    Oct 2001
    Location
    Dublin, Eire
    Posts
    880
    It is possible to create a button at run-time in VC++. I don't know if the question was here. Just remember that you have to create it using "new" if you want it to out last the function where you create it.

    Changing the name of a button at run-time can be done as I said using SetWindowText.
    Elrond
    A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
    -- George Steiner

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)