473,396 Members | 2,057 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.

need to show an error message...

sir, i'm sorry for having lack of knowledge in coding.

i need to convert the textbox field to numeric field.i used the code like this

Convert.ToInt32(textBox1.Text); this code is used to convert string to integer.

Now i need to print an error message by messagebox like "Please enter the Number"..

the following codes i made having no sense i think..

if(String.Equals(textBox1.Text) == true)
{
MessageBox.Show("Please enter the Number");
}

can you help me???
Feb 23 '11 #1
1 1363
GaryTexmo
1,501 Expert 1GB
I'd suggest having a look at the int.TryParse method here instead. Have a look at the MSDN page: http://msdn.microsoft.com/en-us/library/f02979c7.aspx

You can use this as your if check before displaying the error message. Please have a look at the examples on the bottom of the page.

You can likely put this code in one of the validation events on the textbox.
Feb 23 '11 #2

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

Similar topics

2
by: John Sutter | last post by:
I have a webpage which has a few asp:textbox's and an asp:button. I also have a few RequiredFieldValidators for these text boxes. When I click on the button while the textboxes are empty, I don't...
25
by: Mark | last post by:
I'm just starting out in an introductory ASP.Net course, and am trying to run a simple program but keeping getting an error. I'm running XP, have installed Internet Information Services (5.1) ,...
5
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This is used for comparing a value enterd by the user against the primary key in the SQL database. IF the VALUE ENTERED BY THE...
8
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the...
2
by: ad | last post by:
I have a customErrors section in Web.config. All error except error 403 and 404, will be redirect to GenericErrorPage.aspx. How can I show the e.Message or some explicit statement according...
0
by: John A Grandy | last post by:
visual studio .net 2003 somehow i have changed my vs.net vb.net code-editor configuration so that squiggly underlined errors no longer show the error message when the cursor is placed on them...
2
by: mirianCalin | last post by:
hi.. im doing a site.. i have this registration form where the user must enter some information like name, phone_number, age, etc.. an error message should appear if #1: there is an empty...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.