taboo' calling vb namespace from c#

  • Thread starter Thread starter Crash
  • Start date Start date
C

Crash

I want to call the
DateAndTime.DatePart()

Method in VB from C#, i have correctly added the reference to the VB dll, etc... but when i call this function like this

DateAndTime.DatePart(DateInterval.Weekday,DateTime.Now,FirstDayOfWeek.Sunday,FirstWeekOfYear.Jan1)

or

DateAndTime.DatePart(DateInterval.Weekday,DateTime.Now)

i get

error: arguments do not match parameters for function 'DateAndTime.DatePart'

but they do match... just as MSDN says... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdatepart.asp

please help... thanks...
 
DateAndTime.DatePart
(DateInterval.Weekday,DateTime.Now,FirstDayOfWeek.Sunday,FirstWeekOfYear.Jan1)

This should work fine. In my tests it works ok anyway.
or
DateAndTime.DatePart(DateInterval.Weekday,DateTime.Now)

This won't work, C# doesn't support default parameters and you will have to
supply an argument to each parameter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top