VB .NET - Catch exception for Blank textboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dugdug
    New Member
    • Mar 2008
    • 3

    VB .NET - Catch exception for Blank textboxes

    I am looking for a code that will show an error if the textbox is either blank or just filled out with blank spaces.

    I'd like the error to be able to stop any further codes from happening?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    That is a very simple task, check if the Text property .Trim() is = "". This is a pretty basic concept, so I would recomend checking in with some basic tutorial sites.
    Code:
    if (myTexbox.Text.Trim()=="")
    {//its empty
    }

    Comment

    Working...