Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Convert Object Into Byte Array?


i have a program (VB6.0) which runs fine, it called a ocx and it return a 3 bytes string.

now, i rewrite the program in VB.net, and again the ocx return as Object type

firstly, i try this:

dim x as String = ocx.get_field("id")

which return x as a string with 1 character only. what i expect is 3 characters

then, i try to do as follows:

dim x as Object = ocx.get_field("id")
dim b as Byte() = CType(x, Byte())

which results in InvalidCastException.

Then, i try in this way:

Dim b As Byte() = System.Text.Encoding.Unicode.GetBytes(ocx.get_field("id"))
dim y as String = System.Text.Encoding.Default.GetString(b)

which gives a string of 2 characters, still i got 2 characters only. I lost the last byte anyway.

Please Help!!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Any Object Into Byte Array. (or At Least Stdpicture To Byte())
Hello. I need to convert any object into a byte array. If that's not possible, I need to at least be able to convert a stdpicture (I think thats the kind of image you get when you get a picture from the clipboard, printscrn...) to a byte array.

I really need to be able to do this to send pictures over directplay.

Please help me out. Thanks.

~Adams555~


edit-----

Didn't want to bump up the topic because the problem was resolved. Thanks for your help onerr0r!!

Convert A BYTE Array To A LONG Array (and Vice Versa)
I have an array of BYTE data types which I need to convert to an array of LONGS (where each Long is 4 of the bytes) and then eventually convert the long array back to a byte array. Currently I'm doing this with a loop to read 4 bytes and convert them to a long and do this for the whole array but I think there must be a quicker way using CopyMemory. Does anyone know how to do it please?

Convert Floating Point Array To Byte Array In C
Right, i think what i need to do is convert a floating point array into a byte array so that my VB program can understand it....

How do i do this in C?

Matt

Convert UDT To Byte Array
I have an array of UDT's that I want to pass from the data layer up the the user interface. The only way I know how to do this without shared references is to copy the array of UDT's into a byte array.

I would be keen If you have a example of how to convert a UDT to a byte array.


Thanks
Mike


[EDIT: Found one of Woka's test projects. Does just the right thing and more!!!!]

Convert BMP In Byte Array
Hello,
I'm working on an application that needs to read a 256 color BMP file into a byte array and then download it into an embedded device.

The download portion is already working (it's been tested using an external application that converts the BMP into a text file (with one byte per line.)

What I would like to do is have the BMP to Byte conversion in my VB6 application.

I have found a class module that will give me the height, width and other information from a BMP file (which is helpful), but I also need the image data itself.

Does anyone have any suggestions on how to approach this?

Thanks in advance,
Geoffrey

How To Convert A Bitmap In Byte Array?
hi

someone know a code allow me to convert the contents of a picturebox to a array or matrix of bytes? or direct acces to the bitmap contents (bytes i wish)

the color point is a Long type
1 Long = 4 bytes.

thnx

Convert UDT To Byte Array And Back
I want to do some low level bit manipulation on a UDT.

Take for instance the following:


Code:
Private Type uMyUDT
lLongVAR As Long
dDoubleVAR As Double
fSingleVAR As Single
bBooleanVAR As Boolean
End Type
I would like to convert this to a byte array of 18 Bytes (4 + 8 + 4 + 2) and then perform Bit Manipulation on this Byte Array.

If I had 2 such Byte Arrays, I would like to be able to Swap the 3-21 bits of the first with the 3-21 bits of the second. Of I would like to flip bit 45, etc.

I would then like to be able to convert this Byte Arrays back to the UDT structure and use this with its new values.

Cany anyone here help me out with this. I think I could do this using only integers and longs, but using singles and doubles is throwing me for a loop.

Any assistance would be MOST appreciated.

Thanks.

Andrew
andrew@aspco.com

How To Convert A String To Byte Array
hi guys,
is it possible to convert a string to a byte array?
if its possible how can it be done?
thanks and pardon me for my newbie question.

Convert String To Byte Array..
hi
I am receiving some data from winsock and its in a string. I need to put the data into a byte array ready to be passed to another function.

I have managed to do this using the following method;


Code:
ReDim Newimage(0 To lSize - 1) As Byte 'resize array

'load the array
For x = 0 To UBound(Newimage())
Newimage(x) = Asc(Mid(rxVideo.Data, x + 1, 1))
Next x
Ideally I would like to find a faster way to do this, and I also tried:


Code:
Newimage()=rxVideo.Data
however, when I examine the byte array which I expect to look like:

Code:
10 11 12
it looks something like this:


Code:
10 00 11 00 12 00
(where the extra 00's have been added. and the array is twice as big)

Basically I need to put the string into the array AS FAST AS POSSIBLE, so any suggestions how I can do this.???
Any suggestions would be great,

thanks,
pete

Convert A UDT Variable To A Byte Array ???
Hi all,

I want to convert a UDT variable to a byte array prior to pass it to a function. My question is how.

Private Type UploadHeader
Date(7) As Byte
Time(7) As Byte
SW_Version(3) As Byte
HW_Version(3) As Byte
End Type

Private Sub Init()
Dim Header As UploadHeader
...
' fill the header
...
' ??? convert Header to byte array ???
Call Func( <byte array> )
End Sub

How To Convert To Byte Array And Back?
I have a user defined type, which I need to convert to byte array and then a way to convert it back.
Any help would be appreciated.

Thank you

Convert Byte Array Into String
how do i convert a byte array into string i.e char ?
thanking you in advance

Convert Image To Byte Array
I'm trying to convert an image to a byte array , so i can save it somewhere else (on another computer), I've tried using OpenURL with Net, and it works...with online images. My function works, but it doesn't save any of the bytes from the source to the destination, cause the source doesn't retrieve any of the bytes, ..heres my code , i'm not sure what i'm doing wrong


Code:
Public Function ConvertImageToByteArray(ByVal srcFile As String, ByVal dstFile As String)
Dim Free As Integer, bytes() As Byte
If FileExists(srcFile$) = True Then
Free% = FreeFile%()
Open srcFile$ For Binary Access Read As #Free%
Get #Free%, , bytes()
Close #Free%
Free% = FreeFile%()
Open dstFile$ For Binary Access Write As #Free%
Put #Free%, , bytes()
Close #Free%
End If
End Function

How Do I Convert A Long To A Byte Array?
I generate a checksum from a string

that checksum is stored into a long variable, but I need to convert it into a byte array

VB Code:
dim MyLng as longdim myBytes(3) as byte MyLng = &hFFFFFFFF 'now I need to find out how to assign the long value to the byte array :(  


can anyone help?

Convert Byte Array To String
VB Code:
dim b as bytedim s as string 'open file as binary and read into b()...... '?? code to convert b to string.  

Convert String To Byte Array
hi guys,
is it possible to convert a string to a byte array?
if its possible how can it be done?
thanks and pardon me for my newbie question.

Convert String Into Byte Array
I have a byte array as part of a user defined type.
How do I convert a string to the byte array?

Convert Byte Array To A Structure
Hi

If I have a byte array can I assign it to a structure? Would I use copymemory?

For example,
typeDATA
   recname as string *4
   npts as long
   value as single
end type

??? Copymemory DATA, byte(0), len(DATA)

Any better way would be appreciated. Thanks

How To Convert Variant To Byte Array?
Is there a way (beside doing it in a loop value by value) to convert a variant, which contain an array of byte data, to a byte array?

How To Convert A Byte Array Into A Structure
How can I convert an array of bytes into a structure in VB.NET? I receive a stream of bytes from a socket connection, and need to convert it into records in a structure. Currently, I can only do that by writing the byte array into a file as binary, then reading the file contents back into a variable with the correct structure. There must be a less clumsy way of doing this.

Schematically, this is what I currently do:


<StructLayout(LayoutKind.Explicit> _
Structure MyStruct
<FieldOffset(0)> Dim a1 As Integer
<FieldOffset(4)> Dim a2 As Integer
<FieldOffset(8)> Dim a3 As Integer
<FieldOffset(12), VBFixedArray(4)> Dim a4() As Integer
<FieldOffset(32), VBFixedArray(4)> Dim a5() As Integer
<FieldOffset(52), VBFixedArray(7)> Dim s1() As Byte
End Structure

...
'4 records. Each record is 60 bytes
Dim MsgStruct(3) As MyStruct
Dim MsgBytes(239) As Byte
...

'Get message from remote computer
MyStream.Read(MsgBytes, 0, MsgBytes.Length)


'How else can I convert MsgBytes to MsgStruct?
FileOpen(1, "data.bin", OpenMode.Binary)
FilePut(1, MsgBytes)
FileClose(1)

FileOpen(1, "data.bin", OpenMode.Binary)
FileGet(1, MsgStruct)
FileClose(1)

VB6 Convert/Copy String To Byte Array
Can anyone help me converting a string into byte array.

Lets say i have string "Hello world" and i want to convert it, copy it to byte array.

To Convert Textbox String To Byte Array
in the below code i need to get get the encoded value from textbox and need to convert it to byte array and then decrypt..

how can i do that
Dim xmlKeys As String 'A combination of both the public and
'private keys Dim xmlPublicKey As String 'The public key only

'The plaintext message in a byte array
Dim PlainTextBArray As Byte ()
'The cyphertext message in a byte array
Dim CypherTextBArray As Byte ()
<LI>In the Form_Load event, create both the public and private keys: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load 'This creates both the public and the private keys Dim rsa As New RSACryptoServiceProvider 'Hold both keys in a global variable that will be used in the
'decryption procedure xmlKeys = rsa.ToXmlString(True) 'Hold the public key to be used in the encryption procedure xmlPublicKey = rsa.ToXmlString(False) End Sub<LI>Type in the procedures that encrypt and decrypt, respectively: Private Sub encrypt() Dim rsa As New RSACryptoServiceProvider 'get the public key so you can encrypt the message: rsa.FromXmlString(xmlPublicKey) 'get the message Dim message As String = TextBox1.Text If message.Length > 58 Then MsgBox("You must use fewer than
59 characters") : Exit Sub 'transform message string into a byte array: PlainTextBArray = (New UnicodeEncoding).GetBytes(message) ' Encrypt CypherTextBArray = rsa.Encrypt(PlainTextBArray, False) 'view the cyphertext in TextBox2: TextBox2.Clear() For i As Integer = 0 To CypherTextBArray.Length - 1 TextBox2.Text &= Chr(CypherTextBArray(i)) Next i 'see the lengths of the plaintext, and the cyphertext Me.Text = "Plaintext Length (Unicode): " & PlainTextBArray.Length
& " Cyphertext Length: " & CypherTextBArray.Length End Sub Private Sub decrypt() Dim rsa As New RSACryptoServiceProvider 'get the keys, thereby creating an RSA object that's identical ' to the one used in the Form_Load event when the keys were first built rsa.FromXmlString(xmlKeys) 'create a byte array and then put the decrypted plaintext into it Dim RestoredPlainText As Byte () = rsa.Decrypt(CypherTextBArray, False) 'Step through the two-byte unicode plaintext, displaying the restored
'plaintext message For i As Integer = 0 To (RestoredPlainText.Length - 1) Step 2 TextBox3.Text &= Chr(RestoredPlainText(i)) Next i End SubTrigger the procedures by button clicks:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click encrypt() End Sub Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click decrypt() End Sub

Help How I Change Or Convert An Array Of Byte To String???
How i change or convert an array of byte to string? , remenber no to unicode please help me i need this urgent in vb6 thanks for everything

Pls. Teach Me How To Convert Variant To Byte Array... Thanks
Hi,
I have a VB program which will call a method in Java (which have been compiled into DLL, COM - using Visual J++) and this method (in Java) will return a Byte Array. I managed to store the Byte Array into VB variant data type, the problem is I got an error while sending the variant via MSXML2.XMLHTTP - send method. For Example:


Code:

Dim out as Variant
'call Java method (encoder.getMessage() in DLL, COM)
'get the Byte Array frm Java & assign it into VB Variant
out = encoder.getMessage()

'trying to send the VB Variant (out) to another application
'using MSXML2.XMLHTTP
Dim objHTTP As New MSXML2.XMLHTTP
objHTTP.Open "post", "http://127.0.0.1:8189", False
objHTTP.setRequestHeader "Content-Type",
"application/vnd.wap.mms-message"
objHTTP.setRequestHeader "Content-Length", UBound(out) + 1
objHTTP.Send out


The error I get is:
"Run-time error '-2147024809 (80070057)' The Parameter is incorrect".

How can I send the VB variant (out) using MSXML2.XMLHTTP? Any info you all provide will be greatly appreciated...
Thank you for your time.

How To Convert An IPictureDisp To Byte Array (and The Opposite)
A stored picture into a picturebox, a LoadPicture(..) return value, how to convert them to a byte array? The .picture property holds the memory handle...

50% of the pages I am looking for in MSDN are missing, or the server is toooooo busy (I can guess why....)

Any Way To Convert Variant To Byte Array Easily?
I'm evaluating a Winsock control whose receive event passes me a variant for the data. I need to parse the data and write it to disk so I copy the variant data to an array of type Byte.

I'm using a for loop to do this. Is there an easier or faster way? I've tried using RtlMoveMemory but it has problems recognizing an array especially if I want to start at a specific element of the array.

Again, I need to parse certain values within the variant. So, if the variant passed is called vaData, e.g. I need to check elements 25 and 26 of vaData for specific values. Perhaps, I am going about this wrong. These are not string values so I know I cannot use Instr or Mid.

Also, if there was a way to write only certain portions of the variant data e.g. elements 13 to the end, to disk, as Byte data (NOT unicode), I probably wouldn't need to copy it over to a byte array in the first place. The reason I think I need an array of type Byte is because some of the fields I have to decode are 8, 16, or 32 bit and they are all part of the same datagram.

Thanks in advance, sorry so long

Having Problem To Convert 16bit Decimal To Byte Array
Hi, i need to get the 16 bit decimal to be converted into hexadecimal and store it into an byte array i.e.Dim lValue1 As Long, lValue2 As Long
Dim bArray(1) As Byte()

lValue1=76
lValue2=231

'Something the convertions like this below
bArray(0)=GetBytes(lValue1) ' i need to get &H4C
bArray(1)=GetBytes(lValue2) ' i need to get &HE7

End

I dont know how to write the 'GetBytes()' function. Can anyone please help me? Thanks!

Convert Byte Array =&gt; String And Vice Versa
I have a byte array of values 1 to 250. How can I convert this to a string to send through the socket? From a string I need to convert it back to a byte array to display it as hex? I need to use a byte array to store the numbers because a string can't store values 10 and above without using more than a byte. A string is necessary for doing something else. Thanks.

Help To Convert Byte Array To Ieee Float And Long Integer
Hi,

I'm reading bytes from a binary file in blocks of four bytes.
I now need to convert to ieee float and long integer

I have tried defining a variable as single concatenating bytes and converting by loading to a variable defined as a single,
I have also tried using Csng. I'm obviously missing a step
Here are the two blocks of bytes.
236, 81, 248, 64
205, 204, 0, 65

The results should be 7.76 and 8.05 for the float conversions
but how do I get there.

Thanks
Valter

Byte Array To Picture Object
Is there any way of assigning the contents of an array of bytes ( bytAll() )
as a Picture object?

I have files in jpeg and gif formats in a RES file and I'm reading them into
my array using the LoadResData function. But I have to then save this into a
temporary file with the correct extension before it can be loaded as the
Picture in an Image control. Is there a way around creating this temporary
file?

Set picTemp = byteAll() won't work

Converting Picture Object To Byte Array
How can I convert an image in the memory to a byte array without saving it to file and reading it to byte array?
I know that I can copy it with memcopy and objptr but I don't know the size to copy! lenb is not working on objects!

A Function That Take A Byte Array And Returns A Byte Array
OK, I have this function that I want to accept a byte array and I would like it to return a byte array.

Code:
Public Function make3d(theImage() As Byte) As Byte()
Dim l As Long
Dim j1 As Long
Dim l1 As Long
Dim k As Long
Dim k1 As Long
Dim i2 As Long
Dim i1 As Long

Dim ai(3200) As Byte

For j = 0 To 1599 Step 1
If j Mod 40 = 0 Then
i = i + 3
End If

l = ai(j) & RShift(&HFF0000, 16)
j1 = ai(j) & RShift(&HFF00, 8)
l1 = ai(j) & &HFF
l = MyMath.min(255, (l * i) / 100)
j1 = MyMath.min(255, (j1 * i) / 100)
l1 = MyMath.min(255, (l1 * i) / 100)


ai(j) = (ai(j) And &HFF000000) + LShift(l, 16) + LShift(j1, 8) + l1
Next j

For k = 1600 To 3200 - 1
If k Mod 40 = 0 Then
i = i - 3
End If

i1 = RShift((ai(k) And &HFF0000), 16)
k1 = RShift((ai(k) And &HFF00), 8)
i2 = ai(k) And &HFF
i1 = MyMath.min(255, (i1 * i) / 100)
k1 = MyMath.min(255, (i2 * i) / 100)
i2 = MyMath.min(255, (i2 * i) / 100)


ai(k) = (ai(k) And &HFF000000) + LShift(i1, 16) + LShift(k1, 8) + i2
Next k

make3d = a1
End Function

Now VB did not complain about the syntax so I assume it's a valid function and function call and when I did call it it went through all the code within the function except when it got to the end at the make3d = a1 statement where I got a Type Mismatch error. So how do you return an array from a function?

Byte Array &gt; String And String &gt; Byte Array ? (See Bottom Of Thread)
i was trying to send an byte array to a sub.. and i got this bug :

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Array argument must be ByRef
---------------------------
OK Help
---------------------------

what should i do? i dont get this bug

Convert Byte To Hex
I'm not sure, but a byte is (0-255). And Hex is (0-9, A-F)
Anyway, I want to convert a byte, such as 255, 83, 0 etc. to Hex

I've been looking on google for about ten or twenty minutes, but had no luck

Convert Hex To Byte
Hi,

Does anybody know how to convert Hex to Byte?
I'm doing application for food court system using smart card reader using VB6
I'm really new at VB so please if anybody can help??
Plus authentication using SET A or SET B key (such A0,A1,A2,...)..does anybody know about this set key?
Can u please explain it?

Thank you very muchh..

Convert Byte To String?
is there a way to convert byte data type to string?

"No one can know everything, only so much as to drive us to look for the rest." -PrOpHeT-

Urgent: Convert Byte From C++ To Vb
static BYTE tblLookup1[] = {
0xFE,0xD2,0x1D,0x6C,0x41,0xBA,0xEA,0x51,
0x87,0xFC,0x78,0x5B,0x47,0xC7,0x30,0xC0,
0xF7,0x98,0xF6,0x6B,0x14,0xD9,0x57,0x94,
0x42,0xE7,0xCB,0xE4,0x44,0x40,0x8D,0x08,
0xBF,0xCA,0xB7,0x63,0xAE,0xD0,0xC4,0xAA,
0x1C,0x3F,0x60,0x27,0x2C,0x0C,0x72,0x4E,
0x00,0x58,0xC1,0x23,0x79,0x88,0x28,0x59,
0xEE,0x04,0x0B,0x45,0x6D,0x6E,0x9B,0x7C,
0x0E,0xCC,0x10,0x25,0xD3,0x4A,0x4D,0xD4,
0x77,0x2E,0x66,0x34,0x73,0x7B,0xE2,0xEB,
0x7E,0x68,0x8E,0x35,0xA0,0x5C,0x74,0xA8,
0xC3,0x7D,0x3B,0xAD,0xA3,0xE3,0x17,0x5F,
0xFB,0x4B,0x7A,0xB5,0x09,0xEC,0xAB,0x49,
0x20,0xF3,0xE5,0x71,0x21,0x1F,0xC6,0x03,
0xDF,0x64,0xDB,0xB1,0x56,0x67,0x61,0x54,
0x0D,0x9F,0x2F,0x93,0x15,0x05,0x38,0x26,
0xFF,0x2B,0xE0,0x91,0xBC,0x43,0x13,0xAC,
0x76,0x01,0x85,0xA2,0xB6,0x36,0xCD,0x3D,
0x06,0x65,0x07,0x92,0xE9,0x24,0xA6,0x69,
0xBB,0x16,0x32,0x19,0xB9,0xBD,0x70,0xF5,
0x3E,0x33,0x46,0x9A,0x4F,0x2D,0x39,0x53,
0xE1,0xBE,0x9D,0xD6,0xD1,0xF1,0x8B,0xAF,
0xFD,0xA5,0x3C,0xDA,0x84,0x75,0xD5,0xA4,
0x0F,0xF9,0xF2,0xB8,0x90,0x8F,0x62,0x81,
0xEF,0x31,0xED,0xD8,0x2A,0xB3,0xB0,0x29,
0x86,0xCF,0x97,0xC9,0x8A,0x82,0x1B,0x12,
0x7F,0x95,0x6F,0xC8,0x5D,0xA1,0x89,0x55,
0x3A,0x80,0xC2,0x50,0x5A,0x1A,0xE6,0x9E,
0x02,0xB2,0x83,0x48,0xF4,0x11,0x52,0xB4,
0xDD,0x0A,0x18,0x8C,0xDC,0xDE,0x37,0xFA,
0x1E,0x99,0x22,0x4C,0xA7,0x96,0x9C,0xA9,
0xF0,0x5E,0xCE,0x6A,0xE8,0xF8,0xC5,0xD7 };



it is c++

how can i convert this to visual basic?

Convert Byte To Float In VB
At my VB end i will need to convert every 4 bytes to a floating point number....how do i do this?

Matt

How To Convert Byte To Integer?
er... you posted this question a lot... without any details...

is this what you want?


VB Code:
Dim someVar As ByteDim someOther As Integer' assign stuff to byte ' implicitly converts byte to integersomeOther = someVar ' do stuff with integer  


- Dim A

Convert String To Byte?
hi,

This is probably an easy one for you.. How can I convert the following string:

k0

To a byte and ignore the "k"? so that all I get is a byte of 0?

Thanks,

dan

Convert Byte To String
How can i convert the datatype "byte" to "string *1"?

Thank you very much!

Convert To Float From Byte Values
I have an array of bytes that is a receive buffer from a winsock. Four of these bytes make up a 4 byte float, a single precision number in VB6.

How do I convert these four bytes into a single precision float in VB?

Convert Byte To Signed Integer?
Does anyone have any code examples of converting a single byte to a signed integer? I've searched but can't find any examples. TIA

How To Convert 4 Byte Binary To Single???
I'm stuck...
How do I convert binary to Single (Short real IEEE 32bit)
,01000001,11011001,01011011,00000011


Does anybody know if VB's single are the same as short real??? If not what does the bits represent?

Best Regars/ Toby

Help Converting Long To Byte Array And Byte Array To Long
Here is the issue I have. When I try to convert a long to a byte array then convert it back i get funky results

Code: cByteToLng

    Dim lValue As Long
    
    lValue = Val("&H" _
    & Right$("0" & hex(cData(0)), 2) _
    & Right$("0" & hex(cData(1)), 2) _
    & Right$("0" & hex(cData(2)), 2) _
    & Right$("0" & hex(cData(3)), 2) _
    & "&")

    cByteToLng = lValue
    
Exit Function

Now when I call
Code:
Public Function cLngToByte(ByVal lng As Long) As Byte()
On Error GoTo ErrHandler
Dim ByteArray(0 To 3) As Byte

    CopyMemory ByteArray(0), ByVal VarPtr(lng), Len(lng)
    cLngToByte = ByteArray
    
    Call cByteToLng(cLngToByte)

Exit Function
ErrHandler:
    Err.Raise Err.Number, Err.Source, Err.Description
End Function


When I call the cLngToByte and then send the result immediatly to the cByteToLng i get -184549376 instead of 245 and i also get 184549376 instead of 594

Also I have a buffer of 2097152 bytes or 2MB is this also a problem?




Edited by - BooyaCS on 2/9/2006 1:45:07 PM

How To Convert Byte Into Upper And Lower Nibble
I am getting the value from text4.text fromthe slider value what value come in text4 i want to convert into upper and lower nibble i tryed with this code but i am getting the output ,problem is
Code:

Private Sub Command4_Click()
    Dim num As Byte
    Dim num1 As Byte
    Dim data As Byte
    data = Text4.Text
    'Debug.Print data;
    num = data
    'num = num Mod 10
    'Debug.Print num
    'num = "8" & num
    'Debug.Print num
    num=num And &HF    
    num = num Or &H80' here is the problem &h80 is appending data to num ,if slider value is 17 then 7 should be append with &h80 and 1 sholud append with &H90 eg : 87 ,91 but in my code it gives tge lower nibble value 83 and upper nibble value 91 Can any body help me . thank u
     Sleep 200
    'Text5.Text = Hex(num) 'Lower Nibble
    Text5.Text = num
    num1 = data
    'Debug.Print num1
    num1 = num1 And &HF0
    num1 = num1 / 16
    num1 = num1 Or &H90
    'num1 = num1 / 10
    'Debug.Print num1
    'num1 = "9" & num1
    Sleep 200
    'Text6.Text = Hex(num1) 'Upper nibble
    Text6.Text = num1

Converting A String Array Into A Byte Array
Hello,
I'm trying to convert a string array to a byte array. How would I do this?


Code:

dim arrdata(2)
dim bytearrary (2)
arrData(0) = "ID"
arrData(1) = txtname.Text
arrData(2) = "VARTEMP"
thanks
hoz

Copy Memory From 2d Array To 1d Byte Array
Is there a way to use copymemory API to get the 2D single array and map it to a 1D byte array? I'm trying to "flatten" single data array into a byte array which can be stored in SQL database.

I managed to do 1D to 1D and 2D to 2D data flattening, but SQL doesn't store a 2D byte array correctly (or it only store just only one dimension of the array). So I'll have to find a way to map 2D single array into 1D byte array.

My first thought was to maybe map and then concatenate two 1 D array together. That might be the only way, unless somebody knows a better answer.

Thanks a lot in advance.

Copy Part Of A Byte Array Into A New Array
Hello,

How can I copy part of a byte array "argArray()" into another byte array "argArray_temp()" beginning at a certain offset?

Thanks for any help.

- Jake

Copyright 2005-08 www.BigResource.com, All rights reserved