hello guys and girls, im new to this forum.. so please be gentle :)
Im developing this application to improve my ability to develop applications in c#.. so far i've fingured out that im not that good at it.
I fetched out my old college coursework case study to work on, and I have found an interesting one.. a ticket booking application for a ferry which writes data to text file (csv).
so far i have developed the UI. it has
- tabControl with 4 tabs
- 1st tab has 7 TextBox Controls, 1 Button Control, 2 dateTimePicker Controls
- 2nd tab has a dataGrid Control and a Button
for time being, the 3rd and 4th tab are empty.
i have created a separate class file called functions.cs
it holds all my functions (like calculating fare, writing to file, reading to file)
the route of the ferry is fixed, so 2 of the textbox(s) are un editable and have a value by default.
I am new to dateTimePicker control. I should say its a marvellous time saving control!
1 of the date time picker (its called current date) is set to the current rundate (for eg: if today is 3rd April 2010, then the control shows 3rd April 2010.. and if you run the application on 12th Devember 2011, the control would show 12th december 2011 and so on.. i think you get my point here)
the problem i am facing is with the next datetimepicker control (which is called journey date).. my logic is incompatible (or i am incompetent) with min and max date properties of the control.
i need the 2nd datetimepicker control's min and max date to be a month ahead of current date..
in short , if the current date is today's date.. then the journey date must always be a month ahead of the current date. i.e. a user has to book for his/her tickets a month ahead of his/her journey.
__________________________________________________________________
another issue i am facing is with the text box. I have a weight limit on my booking. (its a ferry!) i should calculate the total weight of passenger and luggage and adjust the fare accordingly..
i already have my logic coded in my class file functions.cs..
the problem is with the UI..
3 textboxes are involved in this issue. passengerWeight, luggageWeight and theFare textboxes.
getFare() function gets text from passengerWeight and luggageWeight and returns a the fare based on the total weight.. the fare is of the type double.
I need to change the content so fthe textbox totalFare on the fly as soon as the user enters values in passengerWeight and luggageWeight..
if it was javascript, id have done this.. but i tried applying the same logic in c# but, i get this error
Input string was not in a correct format.
this is my code
private void luggageWeight_TextChanged(object sender, EventArgs e)
{
double tpw = Convert.ToDouble(passengerWeight.Text);
double tlw = Convert.ToDouble(luggageWeight.Text);
double fare = getFare(tpw, tlw);
thefare.Text = fare.ToString();
}
the call stack showed me only the first character i entered in the textbox..
so here i am!, clueless what to do... how do i fix this error and solve the dateTimePicker control problem?
any help will be greatly appreciated :)