title: vb6 check to see if textbox is empty
body: <p>There is a similar question to this but it is for C#,  <a href="https://stackoverflow.com/questions/6156458/check-if-textbox-is-empty-and-return-messagebox">Check if TextBox is empty and return MessageBox?</a>. </p>
  
  <p>There is another solution that check if textbox is empty <a href="https://www.daniweb.com/software-development/visual-basic-4-5-6/threads/414651/checking-if-textbox-is-empty" rel="nofollow noreferrer">https://www.daniweb.com/software-development/visual-basic-4-5-6/threads/414651/checking-if-textbox-is-empty</a>, but this works if you are going to check all the textbox in the form. I would like to check some textbox in the form if they are empty or not.</p>
  
  <p>I've written this code to check if textboxes are empty</p>
  
  <pre><code>Private sub checkEmpty()
  If text1.text = "" Or text2.text="" Then
  blank = true
  End If
  End Sub
  </code></pre>
  
  <p>Then added this code to my command button</p>
  
  <pre><code>Private Sub command1_Click()
  checkEmpty
  If blank = true Then
  Msgbox "a text box is empty"
  Else
  Msgbox "Text box has text"
  End If
  End Sub
  </code></pre>
  
  <p>The problem when I start the program it gives the output <code>"Text box has text"</code>  even if there are no text in the text boxes.</p>
  
  <p>What is wrong with this code?</p>