Button.Text property not updated in compiled executable
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Button.Text property not updated in compiled executable

  1. #1
    Join Date
    Sep 2010
    Posts
    23

    Button.Text property not updated in compiled executable

    Hello folks,

    Sometimes (including right now) when i change a property in my program, such as the text property
    of buttons and labels, and i run the debug button in visual studio 2010 (.net 4.0), the text remains
    unchanged.

    button1.Text has been: "Test Credentials" for forever.

    Now i want to change this property to "Test FTP Credentials".

    In visual studio, everything looks and acts normal, but when i hit the debug button, the text is still: "Text Credentials"

    I experienced this problem on other computers and visual studio versions as well, and am not
    entirely sure of the cause, but i think maybe the executable or some parts of it, are cached somewhere, and not updated, but that is just a guess.

    Does this sound familiar to anyone?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,198

    Re: Button.Text property not updated in compiled executable

    Where are you changing the text property? The properties dialog? The source code?

    Also, you can do a rebuild all solution to get rid of any cached files.

  3. #3
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by Arjay View Post
    Where are you changing the text property? The properties dialog? The source code?

    Also, you can do a rebuild all solution to get rid of any cached files.

    I am changing the text property in the properties dialog.

    Can you tell me where i can find the "rebuild" option in VS2010 ?
    I only have the "build" option in the debug submenu.

    Google search did not give me much to go on.
    Last edited by mavy-online; September 5th, 2010 at 03:22 PM.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,198

    Re: Button.Text property not updated in compiled executable

    Look under the 'build' menu for 'Rebuild Solution'.
    Attached Images Attached Images  

  5. #5
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by Arjay View Post
    Look under the 'build' menu for 'Rebuild Solution'.
    Thanks for your trouble, however, that menuitem is missing ?

    I have: file edit view project debug data tools window help

    No build...

  6. #6
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    I found the solution to that on google:

    http://blogs.vertigo.com/personal/ke...udio-2005.aspx

    Unfortunately, the text property is still not updating to the new text, not even after hitting rebuild.

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,198

    Re: Button.Text property not updated in compiled executable

    Good to know, thanks.

  8. #8
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by Arjay View Post
    Good to know, thanks.

    No problem.

    Anyone else have any suggestions as to why the button text property does not update ?

  9. #9
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    422

    Re: Button.Text property not updated in compiled executable

    check in the designer code whether what ever property you are changing in getting updated for the button , text property...

  10. #10
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by vcdebugger View Post
    check in the designer code whether what ever property you are changing in getting updated for the button , text property...

    //
    // button_test_ftp_credentials
    //
    this.button_test_ftp_credentials.Location = new System.Drawing.Point(33, 341);
    this.button_test_ftp_credentials.Name = "button_test_ftp_credentials";
    this.button_test_ftp_credentials.Size = new System.Drawing.Size(236, 25);
    this.button_test_ftp_credentials.TabIndex = 8;
    this.button_test_ftp_credentials.Text = "Test FTP Credentials";
    this.button_test_ftp_credentials.UseVisualStyleBackColor = true;
    this.button_test_ftp_credentials.Click += new System.EventHandler(this.button_test_credentials_Click);
    See, code wise, and Visual studio wise, everything looks correct.

    Its just, when running the compiled executeable, the button still says, "Test Credentials"

    I checked, for the text "test" , and there are only 2 buttons, which have the text: "test"
    The other button is, "Test WEBTOOL credentials" and works fine.

  11. #11
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Image:



    Uploaded with ImageShack.us

    The one on the right obviously is the visual studio, the one on the right is the executeable in
    debug mode.

    The button never changes text.

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,198

    Re: Button.Text property not updated in compiled executable

    Search all your source files for "Test Credentials". Make sure to turn off any search filters that may exclude results.

    Btw, you have other differences as well. For example "Remote Server" vs. "Remote".

  13. #13
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by Arjay View Post
    Search all your source files for "Test Credentials". Make sure to turn off any search filters that may exclude results.

    Btw, you have other differences as well. For example "Remote Server" vs. "Remote".
    Thank you Arjay, Thou art a genius.

    I wrote a small batch script that searches for the relevant text:
    Code:
    set str=test
    set outputfn=test.txt
    
    for /f "tokens=*" %%a in ('dir /b *.cs') do (
    	set fn=%%a
    	call :FUNCTION_findstr
    )
    pause
    exit
    
    :FUNCTION_findstr
    find /i "%str%" "%fn%">>"%outputfn%"
    GOTO:EOF
    which resulted in

    ---------- FORM1.CS
    private void button_test_credentials_Click(object sender, EventArgs e)
    test_ftp_credentials();
    private void button_test_webtool_credentials_Click(object sender, EventArgs e)
    test_webtool_credentials();
    private void test_webtool_credentials()
    MessageBox.Show("The test failed, please check if the server is up,\r\nif the pb webtool is configured correctly,\r\nif the webtool URL is correct.", "Test Failed");
    MessageBox.Show("Webtool Credentials appear valid :-)", "Test Succeeded!");
    MessageBox.Show("Webtool Credentials appear invalid", "Test Failed");
    // Check if all FTP credentials are filled in to enable the test credentials button.
    button_test_ftp_credentials.Enabled = true;
    button_test_ftp_credentials.Enabled = false;
    button_test_webtool_credentials.Enabled = true;
    button_test_webtool_credentials.Enabled = false;
    foreach (string bytestr in bytes)
    calc = int.Parse(bytestr);
    private void test_ftp_credentials()
    ftp_test();
    MessageBox.Show("Wrong FTP username / FTP password / host", "Test Failed");
    MessageBox.Show("FTP Credentials appear valid :-)", "Test Succeeded!");
    private void ftp_test()
    button_test_ftp_credentials.Text = "Test Details";
    button_test_ftp_credentials.Text = "Test Credentials";
    string latestversion = string.Join("", version_arr);
    if (int.Parse(latestversion) > int.Parse(internal_version))
    where i found: button_test_ftp_credentials.Text = "Test Credentials";

    So the property was being changed at run time, and i forgot all about that.


    As for the other differences you mentioned in the image, those are not actually different, they just look different.

    Sometimes that happens, and i have to bring those controls to the front, and then it appears normal:



    Uploaded with ImageShack.us


    Thank you all for your time!

  14. #14
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,198

    Re: Button.Text property not updated in compiled executable

    Glad you got it figured out.

    Btw, Visual Studio has a "Find in files" function built in. It's the folder icon on the toolbar, or you can access it from the "Edit\Find and Replace\Find in files" menu item.

  15. #15
    Join Date
    Sep 2010
    Posts
    23

    Re: Button.Text property not updated in compiled executable

    Quote Originally Posted by Arjay View Post
    Glad you got it figured out.

    Btw, Visual Studio has a "Find in files" function built in. It's the folder icon on the toolbar, or you can access it from the "Edit\Find and Replace\Find in files" menu item.
    Thanks for the tip!

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center