TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
326k
Exception type for non-integer
Jun 27 2013 9:21 AM
This program wants you to enter a stock number and quantity. I wish to know the exception type for non-integer to complete this program.
For example:
DivideByZeroException
is an
e
xception
type if a number is divided by zero.
using System;
namespace _2
{
class Program
{
static void Main(string[] args)
{
re_enter:
while (true)
{
try
{
Console.Write("Enter a stock number: ");
int stockNo = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter a stock quantity: ");
int quantity = Convert.ToInt32(Console.ReadLine());
}
catch (Exception error)
{
Console.WriteLine(error.Message);
if (error is
non_integer
)
{
stockNo = 1;
goto re_enter;
}
}
}
Console.ReadKey();
}
}
}
Reply
Answers (
2
)
Press button from a handled process
DataTable internal index is corrupted:'21'.