Translation c# into VB is needed RRS feed

  • Question

  • hi all of you, I'm stuck, I get the same results using two well-known on-line translators.. Help me out!

    Original c# stuff:


      DateTime displaydate = _calendar.DisplayDate;

    var firstdayofmonth = new DateTime(displaydate.Year, displaydate.Month, 1); var dayofweek = (int) firstdayofmonth.DayOfWeek; DateTime firstdate = firstdayofmonth.AddDays(-((Double) dayofweek) + 1);

    Vb .Net:

    Dim displaydate As DateTime = _calendar.DisplayDate

    Dim firstdayofmonth = New DateTime(displaydate.Year, displaydate.Month, 1) Dim dayofweek = CInt(firstdayofmonth.DayOfWeek) Dim firstdate As DateTime = firstdayofmonth.AddDays(-DirectCast(dayofweek, [Double]) + 1)

    The last line causes an error:

    Error    23    Value of type 'Integer' cannot be converted to 'Double'.  

    Sunday, March 16, 2014 10:28 PM


All replies