I am trying to handle an exception but I'm confused about how I do it. Here is my code
modules.Add(new Modules() {
name = namebox.Text,
code = codebox.Text,
credits = Convert.ToInt32(creditbox.Text),
hours = Convert.ToInt32(hoursbox.Text),
date = semesterbox.Text,
weeks = Convert.ToInt32(semesterweekbox.Text),
studyhours = m1.Calculations(Convert.ToInt32(hoursbox.Text), Convert.ToInt32(semesterweekbox.Text), Convert.ToInt32(creditbox.Text))
});
I'm trying to handle this exception so it does end my code if I do not input values in the textboxes. From the research I've done, I found out that the ToInt32 line might be the issue. Some coders suggested I use the tryparse function. How would I use that function to handle this error?