Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. c# to vb.bet

c# to vb.bet

Scheduled Pinned Locked Moved C#
csharpquestion
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tamimi Code
    wrote on last edited by
    #1

    hi, Could someone please translate this code to vb.net ?

    static string str= "OKVALUES";
    static string encode(string s)
    {
    string strTest = "";
    for (int i = 0; i < s.Length; i++)
    {
    byte b = (byte)s[i];
    strTest += str[b >> 4];
    strTest += str[b & 0xf];
    }
    return strTest ;
    }

    When you get mad...THINK twice that the only advice Tamimi - Code

    D S N T 4 Replies Last reply
    0
    • T Tamimi Code

      hi, Could someone please translate this code to vb.net ?

      static string str= "OKVALUES";
      static string encode(string s)
      {
      string strTest = "";
      for (int i = 0; i < s.Length; i++)
      {
      byte b = (byte)s[i];
      strTest += str[b >> 4];
      strTest += str[b & 0xf];
      }
      return strTest ;
      }

      When you get mad...THINK twice that the only advice Tamimi - Code

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Why?

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • T Tamimi Code

        hi, Could someone please translate this code to vb.net ?

        static string str= "OKVALUES";
        static string encode(string s)
        {
        string strTest = "";
        for (int i = 0; i < s.Length; i++)
        {
        byte b = (byte)s[i];
        strTest += str[b >> 4];
        strTest += str[b & 0xf];
        }
        return strTest ;
        }

        When you get mad...THINK twice that the only advice Tamimi - Code

        S Offline
        S Offline
        SimpleData
        wrote on last edited by
        #3

        Shared str As String = "OKVALUES"
        Private Shared Function encode(ByVal s As String) As String
        Dim strTest As String = ""
        For i As Integer = 0 To s.Length - 1
        Dim b As Byte = CByte(s(i))
        strTest += str(b >> 4)
        strTest += str(b And &Hf)
        Next
        Return strTest
        End Function

        Used: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]

        M 1 Reply Last reply
        0
        • T Tamimi Code

          hi, Could someone please translate this code to vb.net ?

          static string str= "OKVALUES";
          static string encode(string s)
          {
          string strTest = "";
          for (int i = 0; i < s.Length; i++)
          {
          byte b = (byte)s[i];
          strTest += str[b >> 4];
          strTest += str[b & 0xf];
          }
          return strTest ;
          }

          When you get mad...THINK twice that the only advice Tamimi - Code

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Why downgrade perfectly good code ;P


          only two letters away from being an asset

          M 1 Reply Last reply
          0
          • S SimpleData

            Shared str As String = "OKVALUES"
            Private Shared Function encode(ByVal s As String) As String
            Dim strTest As String = ""
            For i As Integer = 0 To s.Length - 1
            Dim b As Byte = CByte(s(i))
            strTest += str(b >> 4)
            strTest += str(b And &Hf)
            Next
            Return strTest
            End Function

            Used: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]

            M Offline
            M Offline
            Md Marufuzzaman
            wrote on last edited by
            #5

            Dim b As Byte = CByte(s(i)) I think the above line will generate a compile error...like 'Char' values cannot be converted to 'Byte'.

            Thanks Md. Marufuzzaman


            Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

            L 1 Reply Last reply
            0
            • N Not Active

              Why downgrade perfectly good code ;P


              only two letters away from being an asset

              M Offline
              M Offline
              Md Marufuzzaman
              wrote on last edited by
              #6

              I do agree... :laugh:   :laugh:

              Thanks Md. Marufuzzaman


              Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

              1 Reply Last reply
              0
              • M Md Marufuzzaman

                Dim b As Byte = CByte(s(i)) I think the above line will generate a compile error...like 'Char' values cannot be converted to 'Byte'.

                Thanks Md. Marufuzzaman


                Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                I agree. Dim b As Integer = Microsoft.VisualBasic.AscW(s(i)) should solve that. :)

                Luc Pattyn


                I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                Local announcement (Antwerp region): Lange Wapper? Neen!


                1 Reply Last reply
                0
                • T Tamimi Code

                  hi, Could someone please translate this code to vb.net ?

                  static string str= "OKVALUES";
                  static string encode(string s)
                  {
                  string strTest = "";
                  for (int i = 0; i < s.Length; i++)
                  {
                  byte b = (byte)s[i];
                  strTest += str[b >> 4];
                  strTest += str[b & 0xf];
                  }
                  return strTest ;
                  }

                  When you get mad...THINK twice that the only advice Tamimi - Code

                  T Offline
                  T Offline
                  Tamimi Code
                  wrote on last edited by
                  #8

                  Thank you all :)

                  When you get mad...THINK twice that the only advice Tamimi - Code

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups