Jump to content
Software FX Community

Problem with sample DreamHouse and date format


User (Legacy)

Recommended Posts

Line 456 DreamHouse Form1.cs

date = (DateTime.Parse(e.Text));

Gives an error on when I run the samples on my danish configured PC I think

you need to have a IFormatProvider to

make this code secure from different PC configurations

The following seems to work ( I have using.System.Globalisation;)

if (e.Axis == chart1.AxisY)

{

date = (DateTime.Parse(e.Text,CultureInfo.InvariantCulture));

string weekday = date.DayOfWeek.ToString();

e.Text = weekday.Substring(0,1);

}

if (e.Axis == _weekAxis)

{

if (e.Text.Length != 0)

{

date = (DateTime.Parse(e.Text,CultureInfo.InvariantCulture));

int weekofyear = ((date.DayOfYear - 1) / 7) + 1;

e.Text = "Week " + weekofyear.ToString() + ", " +

date.Year.ToString();

}

Regards

Magnus Salgo

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...