views:

16

answers:

1

There's the code:

HebrewCalendar Heb = new HebrewCalendar();
DateTime tmp = new DateTime(1964,2,3);
MessageBox.Show(Heb.GetDayOfYear(tmp));

it's very basic and simple, but yet - i get an errors:

Error 1 The best overloaded method match for System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments..

Error 2 Argument 1: cannot convert from 'int' to 'string'

what is the problem?

+3  A: 

I'm not familiar with HebrewCalendar, but given the error message, I'd say that GetDayOfYear is returning an integer.

Try this:

MessageBox.Show(Heb.GetDayOfYear(tmp).ToString());

MessageBox.Show doesn't know how to deal with integers. If you convert it to a string first, it will show you the string representation.

recursive
It's nice when the compiler gives us helpful errors :)
Michael Haren
I don't like you! :)I, with some stupidity, assumed that the problem was with the date function, instead of with the messageBox .. thanks
yossi