title: setting focus in txtboxes in vb6?
body: <p>I'm working with this code for Validating a msktxtbox for Date. Everything works fine but what really annoys me is that after the msgbox pops out and user clicks ok, the focus does not go to mskDOB. it goes to the next "TAB INDEX" control. WHy is it doing it? How do I fix it?  </p>
  
  <pre><code>Dim datCurrentDate As Date
  datCurrentDate = Format(Now, "MM/DD/YYYY")
  If Not (IsDate(mskDOB.Text)) Then
      MsgBox "Please check the Date, and re-enter again", vbInformation, "Error"
      mskDOB.SetFocus
      Exit Sub
      Else
          If Format(CDate(mskDOB.Text), "MM/DD/YYYY") &gt;= datCurrentDate Then
              MsgBox "Please check the Date, and re-enter again", vbInformation, "Error"
              mskDOB.SetFocus
              Exit Sub
          End If
  End If
  </code></pre>