Check the content for a bound textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mihail
    Contributor
    • Apr 2011
    • 759

    Check the content for a bound textbox

    Hello !
    Can you help me, please !

    I have a bound textbox (to a field in a table).
    I wish to check if this textbox become empty while I type into.

    I have tried:
    Code:
        If txtValContor = "" Then...
        If IsEmpty(txtValContor) Then...
        If IsNull(txtValContor) Then...
    but with no success.

    Seems that all this checks the value in the bound field, not what I see in my [Z{snip}] textbox.

    Thank you !
    Last edited by zmbd; May 31 '13, 01:03 AM. Reason: [z{please do not use profanity... even mild - the filters don't like it :) }]
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    Oups. Solved (after 2 hours. UFF).
    If txtValContor.Te xt = "" Then...

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      Where exactly are you entering your code?
      Last edited by zmbd; May 31 '13, 01:23 AM. Reason: [z{looks like I crossposted, hazard of being at home :) }]

      Comment

      • Mihail
        Contributor
        • Apr 2011
        • 759

        #4
        OK with the profanity, zmbd, (but I have white hair after 2 hours for a "simple" task).

        This is my code:
        Code:
        Private Sub txtValContor_Change()
            Dim Vis As Boolean
            Vis = (txtValContor.Text <> "") And (Not IsNull(txtValRepartitor))
            cmdOpenFormCitireRepartitoare.Visible = Vis
            cmdOpenFormCitireCI.Visible = Vis
        End Sub
        
        Private Sub txtValRepartitor_Change()
        Dim Vis As Boolean
            Vis = (Not IsNull(txtValContor)) And (txtValRepartitor.Text <> "")
            cmdOpenFormCitireRepartitoare.Visible = Vis
            cmdOpenFormCitireCI.Visible = Vis
        End Sub
        I have to check two bound textboxes in order to show/hide two command buttons.

        Every time I have needed to check the "other" textbox for NULL because the TextBox.Text works only if the control (the textbox) has the focus.

        Hope that this is the answer you espect.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          ahh.. it is the simple tasks that age us - hence children.
          My work has a very strict profanity filter. In this case, your thread would have been blocked until I got home - worse, a copy of the page would have been sent to my IT security team who would more than likely decided that the entire site needed to be blocked as they error on the side of scorched-and-salted earth.

          Yes, the dot-Text requires the control to have the focus; however, you can usually use the dot-Value - just depends on the information you need returned from the control.
          Last edited by zmbd; Jun 24 '13, 02:05 AM.

          Comment

          Working...