Converting a C# function to VB.net

csharp Saudi Arabia
  • 18 years ago

    I have a problem converting a C# function to vb.net.


    The C# function is as follows:
           private object[] getInsertParameters(DataRow row)
           {
               // find the number of columns
               int columns = row.Table.Columns.Count;
               // create new object to hold sp parameters
               object[] parameters = new object[columns-1];
               //loop through each parameter and give it a value
               //do not set primary key
               for (int i=0;i<parameters.Length;++i)
               {
                   parameters = row[i +1];
               }
               return parameters;
           }

  • 18 years ago


          Private Function getInsertParameters(row As DataRow) As Object()
              ' find the number of columns
              Dim columns As Integer =  row.Table.Columns.Count
              ' create new object to hold sp parameters
              Dim parameters() As Object =  New Object(columns-1) {}
              'loop through each parameter and give it a value
              'do not set primary key
              Dim i As Integer
              For i = 0 To parameters.Length- 1 Step + 1
                  parameters = row(i +1)
              Next
              Return parameters
          End Function


Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond