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
Wong Jun
NA
15
10.8k
I HAVE PROBLEM ABT THIS ERROR "Object Reference not set to an instance object""
Dec 30 2010 4:06 AM
CAN ANYONE PLEASE HELP TO SOLVE THIS THANKX=]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class customer
{
public string custid, custname, rentdate, size;
public double keys, contact;
public customer()
{
custid = "NRIC";
custname = "Please Verify Your Name";
rentdate = "dd-mm-yyyy";
size = "S/M/L";
keys = 000;
contact = 0000000;
}
public customer(string a, string b, string c, string d, double e, double f)
{
custid = a;
custname = b;
rentdate = c;
size = d;
keys = e;
contact = f;
}
public void display()
{
Console.WriteLine("Name: " + custname);
Console.WriteLine("ID: " + custid);
Console.WriteLine("Rent Date: " + rentdate);
Console.WriteLine("Contact: " + contact);
Console.WriteLine("Keys Number: " + keys);
}
public void updatecustid()
{
Console.WriteLine("Enter Your New ID: ");
String Newid = Console.ReadLine();
Console.WriteLine("This is your new customer name" + Newid);
}
public void updatecustname()
{
Console.WriteLine("Enter Your New Name: ");
String Newname = Console.ReadLine();
Console.WriteLine("This is your new customer name" + Newname);
}
public void updatecontact()
{
Console.WriteLine("Enter Your New Contact: ");
double Newcontact = double.Parse(Console.ReadLine());
Console.WriteLine("This is your new contact " + Newcontact);
}
public void updatekeys()
{
Console.WriteLine("Enter Your New Key Number: ");
double Newkeys = double.Parse(Console.ReadLine());
Console.WriteLine("This is your new key " + Newkeys);
}
public void updaterentdate()
{
Console.WriteLine("Enter Your New Rent Date: ");
String Newdate = Console.ReadLine();
Console.WriteLine("This is your new customer name" + Newdate);
}
public void Updatesize()
{
Console.WriteLine("Enter Your New Size: ");
String Newsize = Console.ReadLine();
Console.WriteLine("This is your new size " + Newsize);
}
public string Getcustname()
{
return custname;
}
public void Setcustname(string m)
{
custname = m;
}
public double Getcontact()
{
return contact;
}
public void Setcontact(double c)
{
contact = c;
}
public double Getkeys()
{
return keys;
}
public void Setkeys(double t)
{
keys = t;
}
public string Getcustid()
{
return custid;
}
public void Setcustid(string id)
{
custid = id;
}
public string Getrentdate()
{
return rentdate;
}
public void Setrentdate(string rt)
{
rentdate = rt;
}
public string Getsize()
{
return size;
}
public void Setsize(string m)
{
size = m;
}
~customer()
{
Console.WriteLine(custid + "is not found.");
}
}
class block
{
int boxes;
}
class security
{
public string securid;
public security()
{
securid = "Unknown";
}
public void Display()
{
Console.WriteLine("The Security ID is " + securid);
}
public void Update()
{
Console.WriteLine("Enter Your New Security ID: ");
String Newsecureid = Console.ReadLine();
Console.WriteLine("This is your new Security ID " + Newsecureid);
}
public string Getsecurid()
{
return securid;
}
public void Setsecurid(string m)
{
securid = m;
}
~security()
{
}
}
class Program
{
static void Main(string[] args)
{
int size;
string oldsize, oldname, oldid, olddate;
double oldkeys, oldcontact;
char choice;
Console.Write("Enter Number Of Customers: ");
size = int.Parse(Console.ReadLine());
customer[] name = new customer[size];
customer[] id = new customer[size];
customer[] contact = new customer[size];
customer[] rentdate = new customer[size];
customer[] key = new customer[size];
customer[] boxsize = new customer[size];
do
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("1 .Enter Your Customer Details");
Console.WriteLine("2. Enter Your ID,Name,Contacts,Keys,Size And Display SafeBox(2) details");
Console.WriteLine("3. Display and Modify SafeBox(1)");
Console.WriteLine("4. Display and Modify SafeBox(2)");
Console.WriteLine("5. Update SafeBox(1) Details");
Console.WriteLine("6. Update SafeBox(2) Details");
Console.WriteLine("7. Quit");
Console.Write("Enter Your Choice: ");
Console.WriteLine();
Console.WriteLine();
choice = char.Parse(Console.ReadLine());
switch (choice)
{
case '1':
for (int index = 0; index < size; index++)
{
string custname = name[index].Getcustname();
Console.Write("Enter Your Name: ");
custname = Console.ReadLine();
name[index].Setcustname(custname);
string enterid = id[index].Getcustid();
Console.Write("Enter Your ID: ");
enterid = Console.ReadLine();
id[index].Setcustid(enterid);
double entercontact = contact[index].Getcontact();
Console.Write("Enter Your Contact Number: ");
entercontact = double.Parse(Console.ReadLine());
contact[index].Setcontact(entercontact);
double enterkeys = key[index].Getkeys();
Console.Write("Enter Your Key Number: ");
enterkeys = double.Parse(Console.ReadLine());
key[index].Setkeys(enterkeys);
string entersize = boxsize[index].Getsize();
Console.Write("Enter Your Safety Box Size: ");
entersize = Console.ReadLine();
boxsize[index].Setsize(entersize);
}
break;
case '2':
break;
case '3':
break;
case '4':
break;
case '5':
//oldsize = sb1.Getsize();
// Console.Write("Please Enter New Size: ");
oldsize = Console.ReadLine();
// sb1.Setsize(oldsize);
break;
case '6':
//oldsize = sb2.Getsize();
//Console.Write("Please Enter New Size: ");
// oldsize = Console.ReadLine();
// sb2.Setsize(oldsize);
break;
case '7':
break;
default:
Console.WriteLine("Invalid Choice");
break;
}
} while (choice != '7');
}
}
}
Reply
Answers (
2
)
Display a child form appears as dialogue only to its parent form
how i know about the routing procedure in asp.net MVC Framework