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. Visual Basic
  4. question about vb6.0..data type conversion

question about vb6.0..data type conversion

Scheduled Pinned Locked Moved Visual Basic
helpcsharpquestion
4 Posts 3 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.
  • F Offline
    F Offline
    farah mazhar
    wrote on last edited by
    #1

    i want to convert string into byte....this can be done in vb.net..can somebody help me in doing this in vb6.0..here the simple code.. Private Sub Form_Load() Dim str1 As String Dim i As Byte i = CByte(Val(str1)) Text1.Text = i End Sub but this code still not able to convert string into byte....and still giving type mismatch error....i m unable to solve this small problem farah farah

    R F 2 Replies Last reply
    0
    • F farah mazhar

      i want to convert string into byte....this can be done in vb.net..can somebody help me in doing this in vb6.0..here the simple code.. Private Sub Form_Load() Dim str1 As String Dim i As Byte i = CByte(Val(str1)) Text1.Text = i End Sub but this code still not able to convert string into byte....and still giving type mismatch error....i m unable to solve this small problem farah farah

      R Offline
      R Offline
      RichardBerry
      wrote on last edited by
      #2

      Which line gives the error?

      farah mazhar wrote:

      Text1.Text = i

      Perhaps the problem is: Text1.Text (String Datatype) = i (Byte Datatype) MisMatch... Not sure why you convert Integer to string, and then back to string for the Textbox? This may be of interest (but its vb.Net so not sure about VB6): Convert a decimal value to binary, octal, or hexadecimal The ToString method of the Convert class lets you easily and quickly convert a decimal value into a string representation of that number to binary, octal, or hexadecimal base: ' convert to binary Convert.ToString(11, 2)) ' => 1011 ' convert to octal Convert.ToString(123, 8)) ' => 173 ' convert to hexadecimal Convert.ToString(254, 16)) ' => fe The ToString method is overloaded to take a Byte, a Short, an Integer, or a Long value in the first argument; the second argument can only be 2, 8, 10, or 16, else an exception will be thrown -- modified at 6:18 Thursday 8th November, 2007

      1 Reply Last reply
      0
      • F farah mazhar

        i want to convert string into byte....this can be done in vb.net..can somebody help me in doing this in vb6.0..here the simple code.. Private Sub Form_Load() Dim str1 As String Dim i As Byte i = CByte(Val(str1)) Text1.Text = i End Sub but this code still not able to convert string into byte....and still giving type mismatch error....i m unable to solve this small problem farah farah

        F Offline
        F Offline
        farah mazhar
        wrote on last edited by
        #3

        thanx for ur help but i need the code in vb6.0....can anyone help me for this...i need this for my project....thanx in advance farah

        N 1 Reply Last reply
        0
        • F farah mazhar

          thanx for ur help but i need the code in vb6.0....can anyone help me for this...i need this for my project....thanx in advance farah

          N Offline
          N Offline
          nlarson11
          wrote on last edited by
          #4

          +convert byte array to string StrConv(btArray, vbUnicode) +convert string to byte array make the byte array the same size as the string use copymemory api. CopyMemory btArray(0), ByVal sText, UBound(btArray)+1

          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