Thread: Need help urgent with error!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    5

    Need help urgent with error!!

    I got this code (a snippet):

    Code:
        class PrintMenu
    
        {
    
            public int Hoofdmenu()
    
            {
    
                try{
    
                    Console.Clear();
    
                    int Keuze = 0;
    
                    Console.WriteLine("**** Welkom bij het DBA project van Vandersteegen Jan ****");
    
                    Console.WriteLine("----------------------------------------------------------\n\n");
    
                    Console.WriteLine("Kies wat u wilt doen: \n");
    
                    Console.WriteLine("  |***********************************************************************|");
    
                    Console.WriteLine("  | 1: Inlezen van CSV bestand met nieuwe gebruikers om aan te maken.     |");
    
                    Console.WriteLine("  | 2: Exporteren van bestaande gebruikers naar een CSV bestand           |");
    
                    Console.WriteLine("  | 3: Verwijderen van bestaande gebruikers op basis van een CSV bestand  |");
    
                    Console.WriteLine("  | 4: Afsluiten van het programma                                        |");
    
                    Console.WriteLine("  |***********************************************************************| \n\n");
    
                    Console.Write("U keuze: ");
    
                    Keuze = int.Parse(Console.ReadLine());
    
    				
    
                    return Keuze;
    
               }
    
                catch (Exception ex)
    
               {
          ......
    at the part where it says: Keuze = int.Parse(Console.ReadLine());
    I get an error. It looks like it keeps skipping the readline part and just tries to convert nothing to a integer.
    I tried making a seperate string variable for my input and then converting it to an int but that just gives me the same error... just like its skipping the readline like I said, and doesn't wait for my input :s

    Any help would be very appreciated.

    to be exact it's this error:
    System.ArgumentNullException: Argument cannot be null.
    Parameter name: s
    at System.Int32.Parse (System.String s) [0x00000]
    at VandersteegenJan_DBAProject_2010.PrintMenu.Hoofdme nu () [0x0006b] in /home/jean/Desktop/VandersteegenJan-DBAProject-2010/VandersteegenJan-DBAProject-2010/Program.cs:138
    this all works in windows visual studio but not in monodeveloper 2.2 on linux
    Last edited by Tiglet; 03-14-2010 at 02:46 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM