5281
asked on
.net set focus on control without submitting form
I want to promp user to input resolution before submit a form. How can I set focus on the resolution textbox and without submitting form if the resolution textbox is empty.
The app is in vb.net, I think I need the code in vb.net. Thanks.
The app is in vb.net, I think I need the code in vb.net. Thanks.
ASKER
when I moved your code in my Visual Studio, somehow, I have error under String.Empty() and MessageBox
String.Empty() - Error 100 Argument not specified for parameter 'index' of 'Public ReadOnly Default Property Chars(index As Integer) As Char'.
MessageBox - Error 101 'MessageBox' is not declared. It may be inaccessible due to its protection level.
What happened? This is asp.net web application.
String.Empty() - Error 100 Argument not specified for parameter 'index' of 'Public ReadOnly Default Property Chars(index As Integer) As Char'.
MessageBox - Error 101 'MessageBox' is not declared. It may be inaccessible due to its protection level.
What happened? This is asp.net web application.
Sorry, try changing the sub to Public.
You said it was vb.net
You said it was vb.net
ASKER
It is still same errors after change sub to Public.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's what I thought too. I got it now. Thank you.
if txtResolution.text = String.empty() Then
MessageBox.Show("Please enter a resolution", "No Resolution Entered", MessageBoxButtons.OK, MessageBoxIcon.Error);
Else
<Process Form...>
End If
End Sub