2
Reply

FormateException Was UnHandled

Seenu Chiranjeevi

Seenu Chiranjeevi

Nov 15 2014 2:51 AM
751
  i wrote a code in c# language as console application, i got error at GETTING INPUT IN ADDRESS AREA, see below mentioned comment,
public class bloodgroupdetails
{
int[] emp_code = new int[10];
string[] emp_name = new string[30];
int[] age = new int[5];
char[] address = new char[30];
char[] blood_grp = new char[10];
int[] salary = new int[10];
public int n, i;
public void getdata()
{
Console.WriteLine("\n how many employee details are going to be get:");
n = int.Parse(Console.ReadLine());
for (i = 0; i < n; i++)
{
Console.WriteLine("\nEnter the employee code:");
emp_code[i] = int.Parse(Console.ReadLine());
 
Console.WriteLine("\n enter the employee name:");
emp_name[i] = Console.ReadLine();
Console.WriteLine("\n enter the age:");
age[i] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\n enter the address:");
address[i] = Convert.ToChar(Console.ReadLine());  //// when i get input from user at runtime it show FORMATEEXCEPTION WAS UNHANDLED and                                                                                                       i cannot go forward to get furture input.
Console.WriteLine("\n enter the blood group:");
blood_grp[i] = char.Parse(Console.ReadLine());
Console.WriteLine("\n enter the salary:");
salary[i] = int.Parse(Console.ReadLine());
}

Answers (2)