none
Textboxes on Form do not Allow Selecting by Clicking, only by Tabbing RRS feed

  • Question

  • I have a form, for which each textbox has a controlsource which feeds from an Excel worksheet.

    I need the form to refresh after the user changes certain values, so that the Excel sheet will calculate some of the cells to which textboxes are bound and display the new values.

    I tried the following:

    frmThisForm.Hide

    frmThisForm.Show

    That works to display the new values.  However, there is then the following strange glitch:  the user can only tab from textbox to textbox (and to command buttons).  The user is not able to click on the textboxes nor on commandbuttons which are not activated by having tabbed there first.  How would I change this behavior?


    Temi Unger .Net Developer

    Thursday, November 20, 2014 12:24 PM

Answers

  • Thank you for the tip about the change property.  I may try it on this form or a different one.  I wrote a formula to look up the value in the cell on the form which was dynamic (based on a formula).  The corresponding textbox, which is no longer bound, gets loaded with the value of the cell on loading the form and gets refreshed (by looking up the value on the worksheet) after a change to one of the other textboxes.  This way, there is no need to unload and reload the form, which was causing other issues to Excel, as well.

    Temi Unger .Net Developer

    • Marked as answer by TemiU Sunday, November 23, 2014 7:51 AM
    Sunday, November 23, 2014 7:51 AM

All replies

  • When you use the ControlSource property, the content of a Textbox is written to the sheet when you leave the TextBox (when the Exit event is raised).

    When you want to write the contents immediately, you must use the Change event instead and write the contents to the appropriate cell by yourself.

    Why the user should not be able to click into textboxes or on commandbuttons... I don't know, absolutely unusual, maybe that behavior is related to your code? I need to see your file before I can say more.

    Please upload your file (maybe with anonymous data) on an online file hoster like www.dropbox.com and post the download link here.

    Andreas.

    Thursday, November 20, 2014 7:18 PM
  • Thank you for the tip about the change property.  I may try it on this form or a different one.  I wrote a formula to look up the value in the cell on the form which was dynamic (based on a formula).  The corresponding textbox, which is no longer bound, gets loaded with the value of the cell on loading the form and gets refreshed (by looking up the value on the worksheet) after a change to one of the other textboxes.  This way, there is no need to unload and reload the form, which was causing other issues to Excel, as well.

    Temi Unger .Net Developer

    • Marked as answer by TemiU Sunday, November 23, 2014 7:51 AM
    Sunday, November 23, 2014 7:51 AM