Question: must stop the user from proceeding if the textbox is null, 

if the textbox has only spaces in it.

i tried . trim but that doesnot work, still spaces are excapted as valid characters.

Answer: 
If you are using .NET 4 - [String.IsNullOrWhiteSpace](http://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace.aspx)

```
If String.IsNullOrWhiteSpace(theTextBox.Text) Then
    ' process the error.
End If

```

Otherwise [String.IsNullOrEmpty](http://msdn.microsoft.com/en-us/library/system.string.isnullorempty%28v=VS.90%29.aspx)

```
If String.IsNullOrEmpty(theTextBox.Text.Trim()) Then
    ' process the error.
End If

```
```
 Dim tempstring As String
        tempstring = TextEdit1proceed.Text.Trim.ToString
        MessageBox.Show(tempstring)

        If tempstring = Nothing Then
            MessageBox.Show("Enter a Username")
        Else

```