How to declare variable containing character limiting to 1000 bytes in vb6
A:
This is a rough approximation. It assumes you are flexible with that 1000 byte limit.
Private mData As String
Public Property Let Data(value As String)
If Len(value) <= 1000 Then
mData = value
Else
'Do whatever '
End If
End Property
ChaosPandion
2009-08-17 06:49:29
I had no idea... +1
ChaosPandion
2009-08-17 15:29:32
+4
A:
Here is the syntax for a fixed-length string of 500 characters, which is 1000 bytes. VB6 strings are Unicode (UTF-16) and therefore each character has two bytes. The value of a fixed-length string will always have 500 characters - trailing spaces will be added, or excess characters truncated.
Dim s As String * 500 ' 500 characters, 1000 bytes
I wonder whether you are dealing with binary data rather than text. The Byte data type is better for binary data.
Dim byt(1000) as Byte ' an array of 1000 bytes
MarkJ
2009-08-17 11:02:30