Alternatives
Members may post updates or alternatives to this current article in order to show different
approaches or add new features.
12 Jan 2013sumit kausalye 3 alternatives
DateTime datenow = DateTime.Now;int age=0;age =Convert.ToInt32(ddlyear.SelectedItem.Text).ToString();int result = 0;result =Convert.ToDateTime(datenow).ToString() - Convert.ToInt32(age).ToString();txtage.Text = result.ToString();
The code has serious issues it wont even compile.You are totally confused with the conversions. I would suggest understand the basics of assignment operations too.you are trying to store a string data into an integer variable 'age' at the following location which is wrong you never store a...
13 Jan 2013Andreas Gieriet
Your code is rather weird.You seem to have little understanding of the C# type system[^].You seem to try to calculate a start date/time by subtract some "age" from "now".What is "age"? seconds, minutes, hours, days, weeks, monts, years, centuries, mayan-cycles ;-)...?Anyways: when...
I'm a software developer and enjoy .net, angular, mvc, and many other different languages.