So I have 2 classes, one called DataTypes.cs and one called Doelen.xaml.cs
code DataTypes.cs:
//Doelen
public static double Omzet = 0;
public static double Marge = 0;
public static double NieuweKlanten = 0;
//capaciteit
public static double cUurPWeek = 0;
public static double cUurPWeekSF = 0;
public static double cPercTot = 0;
//saleskit
public static int skProspects = 0;
public static int skHotProspects = 0;
public static int afsMak = 0;
public static int afs = 0;
public static int offMak = 0;
public static int gescOff = 0;
public static int newKlant = 0;
//conversie
public static double convPHP = (Convert.ToDouble(skHotProspects / skProspects)) * 100;
public static double convHPAM = (Convert.ToDouble(afsMak / skHotProspects)) * 100;
public static double convAMA = (Convert.ToDouble(afs / afsMak)) * 100;
public static double convAOM = (Convert.ToDouble(offMak / afs)) * 100;
public static double convOMGO = (Convert.ToDouble(gescOff / offMak)) * 100;
public static double convGONK = (Convert.ToDouble(newKlant / gescOff)) * 100;
code Doelen.xaml.cs:
private void btnNext_Click(object sender, RoutedEventArgs e)
{
DataTypes.Omzet = Convert.ToDouble(txxOmzetMaand.Text);
DataTypes.Marge = Convert.ToDouble(txxMargeMaand.Text);
DataTypes.NieuweKlanten = Convert.ToDouble(txxNieuwKlantMaand.Text);
}
code Doelen.xaml
<StackPanel x:Name="datFieldMnd" Orientation="Vertical" Margin="0,15,10,0">
<TextBox x:Name="txxOmzetMaand" TextWrapping="Wrap" Width="40px" Height="20px" Margin="0,7,0,0"/>
<TextBox x:Name="txxMargeMaand" TextWrapping="Wrap" Width="40px" Height="20px" Margin="0,7,0,0"/>
<TextBox x:Name="txxNieuwKlantMaand" TextWrapping="Wrap" Width="40px" Height="20px" Margin="0,7,0,0"/>
</StackPanel>
When I click btnNext it throws this exception:
System.TypeInitializationException was unhandled Message: An unhandled exception of type 'System.TypeInitializationException' occurred in SalesKicker2.exe Additional information: The type initializer for 'SalesKicker2.DataTypes' threw an exception.
What am I doing wrong here?
I also took a look at this question: WPF Type initialization Exception in C#. But the answers to this question didn't help at all. One guy even said that he had t0 create a new project and that's what I`m not going to do. And I've also tried to import the following packages:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
This didn't change a thing.
So, once again, can someone help me out?
Thanks in advance!