Hi, I am using visual studio 2012 and c++ language to create a windows form that serves as a time card for employees. I'm stuck in the part where I subtract the lunch time span from the total hours worked that day. In short, I'm trying to subtract two string which come from total hours worked and total lunch time text boxes. Those two values from the text boxes originate from four date time picker boxes, who's values where converted to string in order to be able to be displayed in those two text boxes. Below is a link to show how the program looks.
Do I have to convert the string back again? I've tried but get an error, also as you can see in the link's image, the text box values are numbers stored as a string from the datetimepicker who's format is datetime.
Hello, I've not really done any CLI programming in C++ but I think I can see your problem with the code you provided; the problem is that you don't convert the text from the textboxes into an integer. Otherwise, you are just trying to subtract one string from another which isn't possible.
I would use the "atoi" or "stoi" functions to convert a string to an integer.