vb6 code to C#

  • 12 years ago

    Hi! guys.

    how do i convert this code to c#, Buffer is a string 

    GetIniValue = Left(buffer, InStr(buffer, Chr(0)) - 1)

  • 12 years ago

    A C# equivalent that you can use for Left is:

    buffer.Substring(0,length)

    and for InStr, you can use:

    buffer.IndexOf() 

    So your code would look something like this: 

    GetIniValue = buffer.Substring(0,buffer.IndexOf(Convert.ToChar(0)) - 1);

     

     


     


  • 12 years ago
    thanks!
  • 12 years ago

    You're welcome :-) 

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.

“Weeks of coding can save you hours of planning.”