I got this code (a snippet):
at the part where it says: Keuze = int.Parse(Console.ReadLine());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) { ......
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:
this all works in windows visual studio but not in monodeveloper 2.2 on linuxSystem.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