tags:

views:

231

answers:

3

.

 private void Form1_Load(object sender, EventArgs e)
    {

               List<CaclulatedData> tests = new List<CaclulatedData>
                                   {
                                    new CaclulatedData()
                                     {
                                      Bonds = "First Bond",
                                      TransactionList = new List<TransactionData>
                                                {
                                                 new TransactionData() {Debit = "DebitData"}
                                                }
                                     },
                                    new CaclulatedData()
                                     {
                                      Bonds = "Second Bond",
                                      TransactionList = new List<TransactionData>
                                                {
                                                 new TransactionData() {Debit = "123123"},
                                                 new TransactionData() {Debit = "12312", Credit = "3453"}
                                                }
                                     }
                                   };
               gridControl1.DataSource = tests;

    }

}
public class JEString
{

    public string Bonds { get; set; }

}

public class CaclulatedData : JEString
{
    public List<TransactionData> TransactionList { get; set; }
}


public class TransactionData
{
    public string Debit { get; set; }
    public string Credit { get; set; }
}
+3  A: 

You could also, use reflector to convert your .net assembly into any of the below languages.

  • IL
  • C#
  • VB.NET
  • Delphi
  • MC++
Ramesh
+1  A: 

Part of your problem is that vb8 does not yet support some of the features your C# code is using (automatic properties and collection initializers, for example), so the translations is not 1:1. Some of these features were added in VB9. That said, it's not that hard:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim tests As New List(Of CaclulatedData)(2)

    tests.Add(New CalculatedData())
    tests(0).Bonds = "First Bond"
    tests(0).TransactionList.Add(New TransactionData())
    tests(0).TransactionList(0).Debit = "DebitData"

    tests.Add(New CalculatedData())
    tests(1).Bonds = "Second Bond"
    tests(1).TransactionList.Add(New TransactionData())
    tests(1).TransactionList(0).Debit = "123123"
    tests(1).TransactionList.Add(New TransactionData())
    tests(1).TransactionList(1).Debit = "12312"
    tests(1).TransactionList(1).Credit = "3453"

    gridControl1.DataSource = tests
End Sub

Public Class JEString
    Private _Bonds As String
    Public Property Bonds() As String
       Get
          Return _Bonds
       End Get
       Set(ByVal value As String)
           _Bonds = value
       End Set
    End Property
End Class

Public Class CaclulatedData 
    Inherits JEString

    Private _TransactionList As New List(Of TransactionData)()
    Public ReadOnly Property TransactionList() As List(Of TransactionData)
        Get
            Return _TransactionList
        End Get
    End Property
End Class


Public Class TransactionData
    Private _Debit As String
    Private _Credit As String

    Public Property Debit() As String
       Get
          Return _ Debit
       End Get
       Set(ByVal value As String)
           _ Debit = value
       End Set
    End Property

    Public Property Credit() As String
       Get
          Return _ Credit
       End Get
       Set(ByVal value As String)
           _Credit = value
       End Set
    End Property
End Class
Joel Coehoorn