This is a migrated thread and some comments may be shown as answers.

Help with VB on Radcontrols?

1 Answer 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Damien
Top achievements
Rank 1
Damien asked on 22 Mar 2013, 11:42 AM
I'm having trouble with using Radcontrols for WP in VB.net (VS Express 2012).

I don't know C# well enough to convert the code samples given in the documentation. Specifically I'm trying out the Looping List control.

This code is causing me trouble (and online converters don't produce working code either). I just need to populate my loop control with some data:
LoopingListDataSource src = new LoopingListDataSource(10);
src.ItemNeeded += (sender, args) =>
{
    args.Item = new LoopingListDataItem(args.Index.ToString());
};
src.ItemUpdated += (sender, args) =>
{
    args.Item.Text = args.Index.ToString();
};

It's this stuff that is causing me trouble. I'm not sure how to restructure it to VB.net.
src.ItemNeeded += (sender, args) =>
 
{
 
    args.Item = new LoopingListDataItem(args.Index.ToString());
 
};


Could I please get some help converting the above to VB.net so I can test the controls?


1 Answer, 1 is accepted

Sort by
0
Damien
Top achievements
Rank 1
answered on 22 Mar 2013, 01:16 PM

Yay for me, I figured it out!

For future reference if anyone else needs the answer, I had to add handlers (see below). I should be able to populate the data with my own values now.

Public Sub New()

Dim
src As LoopingListDataSource = New LoopingListDataSource(10)
 
       AddHandler src.ItemNeeded, AddressOf src_ItemNeeded
       AddHandler src.ItemUpdated, AddressOf src_ItemUpdated
 
       looper.DataSource = src
 
   End Sub
 
   Private Sub src_ItemNeeded(sender As LoopingListDataSource, args As LoopingListDataItemEventArgs)
       args.Item = New LoopingListDataItem(args.Index.ToString())
 
   End Sub
   Private Sub src_ItemUpdated(sender As LoopingListDataSource, args As LoopingListDataItemEventArgs)
       args.Item = New LoopingListDataItem(args.Index.ToString())
 
   End Sub
Tags
General Discussions
Asked by
Damien
Top achievements
Rank 1
Answers by
Damien
Top achievements
Rank 1
Share this question
or