TimDijkstra
Nieuwe gebruiker
- Lid geworden
- 30 nov 2011
- Berichten
- 1
Mensen,
Ik heb heel internet al rondgezocht maar ik kan echt niet vinden hoe ik deze foutmelding weg kan krijgen. Hebben jullie enig idee?
Groeten,
Tim
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
namespace Syntax4
{
class Program
{
public struct mp3
{
public int id;
public string make;
public string model;
public int MBsize;
public int voorraad;
public decimal Price;
public mp3(int id, string make, string model, int MBsize, int voorraad, decimal Price)
{
this.id = id;
this.make = make;
this.model = model;
this.MBsize = MBsize;
this.voorraad = voorraad;
this.Price = Price;
}
Hier zit de foutmelding ------------> ArrayList array = new ArrayList();
private void arraySave()
{
string opslaan = "";
foreach (mp3 regel in array)
{
opslaan = opslaan + regel.id + ";" + regel.make + ";" + regel.model + ";" + regel.MBsize + ";" + regel.voorraad
+ ";" + regel.Price + Environment.NewLine;
}
using (StreamWriter writer = new StreamWriter(@"C:\\Csharp\\spelers.txt"))
{
writer.Write(opslaan);
writer.Close();
}
}
static void Main(string[] args)
{
string naam;
string result;
Console.WriteLine("Geef je naam:");
naam = Console.ReadLine();
result = LogIn();
switch (result)
{
case "goed":
Console.WriteLine("Welkom bij SoundSharp, " + naam);
ShowMenu();
break;
case "fout":
Console.WriteLine("verkeerd naam/wachtwoord combinatie");
break;
}
Console.ReadKey();
}
public static string LogIn()
{
string wachtwoord;
string uitkomst;
string pass = "SHARPSOUND";
int teller = 1;
while (teller < 4)
{
if (teller == 3)
{
Console.WriteLine("Poging 3 van 3. LET OP: Laatste poging!");
}
else
{
Console.WriteLine("Poging {0} van 3:", teller);
}
teller = teller + 1;
Console.WriteLine("Geef wachtwoord:");
wachtwoord = Console.ReadLine();
if (pass == wachtwoord)
{
uitkomst = "goed";
return uitkomst;
}
}
uitkomst = "fout";
return uitkomst;
}
public static void ShowMenu()
{
int input = 0;
while (input < 9)
{
Console.Clear();
Console.WriteLine("1. Overzicht mp3 spelers");
Console.WriteLine("2. Overzicht ....");
Console.WriteLine("3. panda's");
Console.WriteLine("4. bosjes's");
Console.WriteLine("5. menu");
Console.WriteLine("6. menu");
Console.WriteLine("7. menu");
Console.WriteLine("8. menu");
Console.WriteLine("9. Exit");
input = Convert.ToInt16(Console.ReadLine());
switch (input)
{
case 1:
Console.WriteLine("gekozen actie: 1. Overzicht mp3 spelers");
Console.ReadKey();
break;
case 2:
Console.WriteLine("gekozen actie: 2. 2e menukeuze");
Console.ReadKey();
break;
case 3:
Console.WriteLine("gekozen actie: 3. 3e menukeuze");
Console.ReadKey();
break;
case 4:
Console.WriteLine("gekozen actie: 4. 4e menukeuze");
Console.ReadKey();
break;
case 5:
Console.WriteLine("gekozen actie: 5. 5e menukeuze");
Console.ReadKey();
break;
case 6:
Console.WriteLine("gekozen actie: 6. 6e menukeuze");
Console.ReadKey();
break;
case 7:
Console.WriteLine("gekozen actie: 7. 7e menukeuze");
Console.ReadKey();
break;
case 8:
Console.WriteLine("gekozen actie: 8. 8e menukeuze");
Console.ReadKey();
break;
case 9:
Console.WriteLine("gekozen actie: 9. Exit");
break;
}
}
if (input != 0)
{
Console.ReadKey();
Console.WriteLine("{0}", input);
}
}
}
}
}
Ik heb heel internet al rondgezocht maar ik kan echt niet vinden hoe ik deze foutmelding weg kan krijgen. Hebben jullie enig idee?
Groeten,
Tim
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
namespace Syntax4
{
class Program
{
public struct mp3
{
public int id;
public string make;
public string model;
public int MBsize;
public int voorraad;
public decimal Price;
public mp3(int id, string make, string model, int MBsize, int voorraad, decimal Price)
{
this.id = id;
this.make = make;
this.model = model;
this.MBsize = MBsize;
this.voorraad = voorraad;
this.Price = Price;
}
Hier zit de foutmelding ------------> ArrayList array = new ArrayList();
private void arraySave()
{
string opslaan = "";
foreach (mp3 regel in array)
{
opslaan = opslaan + regel.id + ";" + regel.make + ";" + regel.model + ";" + regel.MBsize + ";" + regel.voorraad
+ ";" + regel.Price + Environment.NewLine;
}
using (StreamWriter writer = new StreamWriter(@"C:\\Csharp\\spelers.txt"))
{
writer.Write(opslaan);
writer.Close();
}
}
static void Main(string[] args)
{
string naam;
string result;
Console.WriteLine("Geef je naam:");
naam = Console.ReadLine();
result = LogIn();
switch (result)
{
case "goed":
Console.WriteLine("Welkom bij SoundSharp, " + naam);
ShowMenu();
break;
case "fout":
Console.WriteLine("verkeerd naam/wachtwoord combinatie");
break;
}
Console.ReadKey();
}
public static string LogIn()
{
string wachtwoord;
string uitkomst;
string pass = "SHARPSOUND";
int teller = 1;
while (teller < 4)
{
if (teller == 3)
{
Console.WriteLine("Poging 3 van 3. LET OP: Laatste poging!");
}
else
{
Console.WriteLine("Poging {0} van 3:", teller);
}
teller = teller + 1;
Console.WriteLine("Geef wachtwoord:");
wachtwoord = Console.ReadLine();
if (pass == wachtwoord)
{
uitkomst = "goed";
return uitkomst;
}
}
uitkomst = "fout";
return uitkomst;
}
public static void ShowMenu()
{
int input = 0;
while (input < 9)
{
Console.Clear();
Console.WriteLine("1. Overzicht mp3 spelers");
Console.WriteLine("2. Overzicht ....");
Console.WriteLine("3. panda's");
Console.WriteLine("4. bosjes's");
Console.WriteLine("5. menu");
Console.WriteLine("6. menu");
Console.WriteLine("7. menu");
Console.WriteLine("8. menu");
Console.WriteLine("9. Exit");
input = Convert.ToInt16(Console.ReadLine());
switch (input)
{
case 1:
Console.WriteLine("gekozen actie: 1. Overzicht mp3 spelers");
Console.ReadKey();
break;
case 2:
Console.WriteLine("gekozen actie: 2. 2e menukeuze");
Console.ReadKey();
break;
case 3:
Console.WriteLine("gekozen actie: 3. 3e menukeuze");
Console.ReadKey();
break;
case 4:
Console.WriteLine("gekozen actie: 4. 4e menukeuze");
Console.ReadKey();
break;
case 5:
Console.WriteLine("gekozen actie: 5. 5e menukeuze");
Console.ReadKey();
break;
case 6:
Console.WriteLine("gekozen actie: 6. 6e menukeuze");
Console.ReadKey();
break;
case 7:
Console.WriteLine("gekozen actie: 7. 7e menukeuze");
Console.ReadKey();
break;
case 8:
Console.WriteLine("gekozen actie: 8. 8e menukeuze");
Console.ReadKey();
break;
case 9:
Console.WriteLine("gekozen actie: 9. Exit");
break;
}
}
if (input != 0)
{
Console.ReadKey();
Console.WriteLine("{0}", input);
}
}
}
}
}