|
-
Feb 24th, 2000, 04:31 AM
#1
Thread Starter
Frenzied Member
I got Type Mismatch error using code similar to the following.
Dim Xbyte as Byte
Dim Xstring as String
Dim OneByte as String*1
Xbyte = Left(Xtring, 1)
Xbyte = OneByte
I thought that Strings were made up of Bytes, and that a Byte was equivalent to a string of length one. I understand that VB might require more than one byte of storage for a string of length one (due to control data for string), but was surprised at Type Mismatch error.
Apparently, I have been manipulating strings without understanding much about them.
Any explanations?
-
Feb 24th, 2000, 04:41 AM
#2
VB uses Unicode to manipulate Strings, this means that it uses 2 bytes for each character, to assign a Single Char String to a Byte Variable do the following:
Code:
Dim sByte As String * 1
Dim bByte() As Byte
sByte = "A"
bByte = StrConv(sByte, vbFromUnicode)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|