473,385 Members | 1,732 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,385 software developers and data experts.

Trouble with NULL in C#

HI
I created a simple windows application where in there is a textbox where I can enter values and iam using
int.Parse( this.textBox1.Text , NumberStyles.Number, CultureInfo.CurrentCulture )
to convert the entered string(which is a number) to a integer.
There is a button which performs certain action taking that number entered in the text.
The problem is when I delete the number in the text field to enter another number
it gives error

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

Additional information: Input string was not in a correct format.

Some one please help me to fix this.
Thanks in advance for the help
Oct 10 '07 #1
3 1018
Shashi Sadasivan
1,435 Expert 1GB
That means that this.textBox1.Text has charachters which cannot be converted to an int

Tyr the tryParse method which will give a boolen indicating if the operation was successful instead of throwing errors.
Oct 10 '07 #2
is TryParse defined in .NET 1.1 framework?
Oct 10 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
oh, ok...

well...i checked out msdn here
Its new to 2.0 so definitely non-existant in 1.1

guess you would have to use try catches around parse

cheers
Oct 10 '07 #4

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

Similar topics

1
by: Chris Todhunter | last post by:
Hi, I am responsible for a growing website. It is password protected and we collect data on everyone who logs in. Every month we produce a report on the trends of users which can result in some...
1
by: G | last post by:
Hello, I have TWO tables. TABLE1 ----------- ID ProgramID 01 Program1 02 Program2 03 Program3 04 Program4 ....
8
by: Pegboy | last post by:
I am having trouble with malloc() again for a PC app I am developing. The method of the suspicious line of code seems to be Ok on a embedded platform, but not with the PC platform. The embedded...
6
by: bas | last post by:
hey, I am having a lot of trouble trying to get this program to work properly. It is supposed to read integers from a file and place them into the categories for inventory. The problem seems to...
2
by: Thomas G. Marshall | last post by:
Arthur J. O'Dwyer <ajo@nospam.andrew.cmu.edu> coughed up the following: > On Thu, 1 Jul 2004, Thomas G. Marshall wrote: >> >> Aside: I've looked repeatedly in google and for some reason cannot >>...
7
by: slashdotcommacolon | last post by:
Hello, I'm working on the exercises from k&r, exercise 5-13 is to implement a simple replacement for the unix tail command. The brief says it should be able to cope no matter how unreasonable the...
1
by: Jay | last post by:
hi people, i am using mysql and i am having the following problem.... I know this is not the correct to ask this problem. but i am need of help urgently thats why i posted this here. but please...
0
by: lkrubner | last post by:
The idea I'm trying to get at is that I want the tag info for the tag "photography", and I want the date, and I want a count of any comments a tag may have. This following query gets back all the ...
3
by: benjamin sago | last post by:
Hello all. I am writing a command shell, but am having trouble with memory allocations. I am trying to tokenise a string into a **char array for execvp (the unix launch-this-program function), but...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.