Help to translate from C# to VB

2 posts, 0 answers
  1. Peer
    Peer avatar
    2 posts
    Member since:
    Aug 2015

    Posted 18 Aug 2015 Link to this post

    Hi.

     I need help, to translate a working C# kode til vb. It's the code highlightet with yellow, that gives me some (all the) troubles:

            private void ReadAppointmentsFromDatabase()

            {

                uiRadSchedulerMain.Appointments.Clear();

                var appointments = new ELHedegaard.BLL.Appointment(); 

                foreach (var appointment in appointments.GetAppointmentsWithResources())

                {

                    Appointment schedulerAppointment = new Appointment();

                    schedulerAppointment.Summary = appointment.Summary;

                    schedulerAppointment.Start = appointment.Start.Value;

                    schedulerAppointment.End = appointment.End.Value;

                    schedulerAppointment.Location = appointment.Location;

                    schedulerAppointment.Description = appointment.Description;

                    //schedulerAppointment.BackgroundId = 1;

                    schedulerAppointment.StatusId = 2;

                    schedulerAppointment.BackgroundId = appointment.ParentID.Value;

                    foreach (var x in appointment.ResourceIds.Select(a => new EventId(a)))

                      

                    {

                        schedulerAppointment.ResourceIds.Add(x);

                        System.Diagnostics.Debugger.Break();

                    }

                    uiRadSchedulerMain.Appointments.Add(schedulerAppointment);

                   //System.Diagnostics.Debugger.Break();

              }

              }

    Kindly Peer​

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Aug 2015 Link to this post

    Hi Peer,

    You can have a look at our online converter as well as this thread on StackOverflow: http://stackoverflow.com/questions/10708158/how-do-i-write-this-lambda-select-method-in-vb-net

    In general, it should be something like this:
    For Each x As EventId In _appointment.ResourceIds.Select(Function(a) New EventId(a))

    I hope this helps.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top