473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using errorprovider control if data not entered

107 100+
Hello,
I have form in C#.
I want to use the errorprovider control to prompt user for data if nothing is entered.
example:
I have textbox1 for user to enter name.
I have radiobuttons for job departments.

I click a button and data displays in labels.
label1.text = textbox1;
if (radiobutton1.clicked)
label3.text = radiobutton1.text "\r\n";

if user not enter name how can I code errorprovider to catch it and display error?
thank you
Jun 12 '09 #1
2 2277
Sl1ver
196 100+
Expand|Select|Wrap|Line Numbers
  1. if (textbox1.text.Trim() == string.Empty)
  2. {      
  3.       MessageBox.Show("Please enter a name");
  4. } else
  5. {
  6.     //code to do what its suppose to do, save or whatever
  7. }
  8.  
Jun 12 '09 #2
buddyr
107 100+
if (textbox1.text.Trim() == string.Empty)
{
ErrorProvider1.Seterror(textbox1, "Enter your name")
else
{
label1.text = textbox1;
}
am trying this
thank you
not sure if I can do same with radiobuttons
Jun 12 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dan K. | last post by:
Hi NG, the problem : im working with the error provider (EP) to remind users of filling required fields. in each control i ve a check method which check the field inputs and set if needed the...
0
by: Steve Randall | last post by:
In VB.NET, how (at runtime) can I determine if a form contains an ErrorProvider component and to get a reference to it? Since an ErrorProvider is a component and not a control I can't see a way to...
6
by: M O J O | last post by:
Hi, How do I check if an ErrorProvider has errors? Take for example this code... (err = ErrorProvider...) Public Sub Test If TextBox1.Text= "" Then
3
by: Jeppe Jespersen | last post by:
I read the following - regarding the ErrorProvider control - in the MOC Course Material for course 2373: "You can set your own error messages manually, as shown in the following example, or when...
4
by: ljlevend | last post by:
I have the following issues: 1. I want to make it so that ToolTips never go away once they are shown until the user moves the mouse outside of the control for which the ToolTip is assigned. It...
5
by: Alvaro Lamas | last post by:
I have a problem with the ErrorProvider with a mdi interface, I have a MDI form which opens a child form, that child form uses the errorprovider to show the problems with the data entry. The...
3
by: J L | last post by:
I have a from with an ErrorProvider on it. I pass a reference of the form to a subroutine where I want to reference the ErorrProvider. I could pass it in the call to the subroutine, but I would...
5
by: Ryan | last post by:
A binding navigator control adds the following code for when the Save button is clicked: Me.Validate() Me.UserBindingSource.EndEdit() Me.UserTableAdapter.Update(Me.UserDataSet.User)" You can...
4
by: Freeon | last post by:
How do I capture the hover event on the ErrorProvider control? I created a custom control and inherited the ErrorProvider. Problem is I don't know which method to override to capture the hover...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.