0
I created a simple application, but when clicking on the action button responsible for saving the data, the program stops working.
Follow picture:
Save button action:-
private void button_Click(object sender, RoutedEventArgs e)
{
Chemical newChemical = new Chemical();
newChemical.ChemicalName = nameField.Text;
newChemical.ChemicalFormula = formulaField.Text;
newChemical.MW = Decimal.Parse(MWField.Text);
newChemical.VFId = Int32.Parse(VFIDField.Text);
ctrl.Create(newChemical);
}
Code of the Control (Ctrl):
public class ChemicalCtrl
{
public ChemicalCtrl()
{ }
public void Create(Chemical ch)
{
//throw new NotImplementedException();
try
{
using (var repo = new Repository<Chemical>())
{
repo.Create(ch);
}
}
catch(CustomExceptionsCtrl err)
{
Console.WriteLine(err);
}
}
}
DETAIL: I have already tested the 'Create()' method in a console application, it is working perfectly.
What does troubleshooting present as an error? If I remember correctly it gets some relevant information in this case.
– Gabriel Coletta
Hello @Gabrielcoletta managed to solve the problem, thank you.
– Renan Narciso