I want users to enter their name into a textbox but i want to ensure that they type in something so my program will continue the name into another form by a button. How do foolproof this while clicking the button won't automatically send nothing to the other form and end up crashing?

Add validation either client- or server-side to check the value of the textbox before proceeding. If the length of the input is too short or non-existent then stop and inform the user.

You'll want to use something like:

If Not TextBox1.Text.IsNullOrWhiteSpace() Then
    ' Allow processing of text entered
Else
    MessageBox.Show("Please enter information in the text box before proceeding!")
End If

Just place:

If TextBox.Text <> "" or TextBox1.Text <> String.Empty Then
    'Place code here'
Else
    MsgBox("Please enter a valid name.")
    e.Cancel = True
End If

Better question...Does each user have an active directory login and are they using this login to launch the application?

Edit to last post

e.Cancel = True

Will only work with certain event arg types.

Return 'For a sub'
'-or'
Return Nothing 'For a function'
'I recommend returning the value that is checked against.'
'Example:'

If MyFunction(0) = True Then

End If


Private Function MyFunction(ByVal myVal as Integer)
    If MyVal > 1 Then
        Return True
    Else
        Return False
    End If
End Function

Use these in those cases

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.