请问如何把一个Byte数组中的内容复制到另外一个数组中呢?

lywei123 2003-12-10 08:50:55
n=LOF(1)
Redim arrByte(1 to n) AS Byte
Redim arrByte1(1 to n) AS Byte
Get 1, , arrBytes
Close 1

For i = 0 To n
arrBytes1(i) = arrBytes(i)
Next

为什么会提示subscript out of range?
...全文
145 点赞 收藏 9
写回复
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
of123 2003-12-10
n=LOF(1)
Redim arrBytes(1 to n) AS Byte
Redim arrBytes1(1 to n) AS Byte
Get 1, , arrBytes
Close 1

For i = 0 To n
arrBytes1(i) = arrBytes(i)
Next

为什么会提示subscript out of range?

*****************************
For i = 1 To n '你声明的是 1 To n
arrBytes1(i) = arrBytes(i)
Next
*****************************
回复
Maconel 2003-12-10
就是strbyte1=strbyte就可以,就是冰的那样。
回复
lywei123 2003-12-10
那如何从arrByte()中提取一部分元素到arrByte1()呢?
比如
k=0
For i=100 To n
arrBytes1(k)=arrBytes(i)
k=k+1
Next

那该怎么实现呢?小弟初学,还请多多帮忙,多谢多谢
回复
踏平扶桑 2003-12-10
n=LOF(1)
Redim arrByte(1 to n) AS Byte
Redim arrByte1(1 to n) AS Byte
Get 1, , arrBytes
Close 1

For i = 0 To n
arrBytes1(i) = arrBytes(i) '这里arrBytes没有看到定义,试一下 northwolves(野性的呼唤) 的答案
Next

为什么会提示subscript out of range?
回复
forever_chang 2003-12-10
n=LOF(1)
Redim arrByte(1 to n) AS Byte
Redim arrByte1(Lbound(arrByte) to Ubound(arrByte)) AS Byte
Get 1, , arrBytes
Close 1

For i = Lbound(arrByte) To Ubound(arrByte))
arrBytes1(i) = arrBytes(i)
Next

回复
SoHo_Andy 2003-12-10
测试通过
Private Sub Command2_Click()
Dim mybyte1() As Byte
Dim mybyte2() As Byte

mybyte1() = "测试"
mybyte2 = mybyte1

MsgBox mybyte1
MsgBox mybyte2
End Sub
回复
AresChen 2003-12-10
灵活一些,想想别的办法:
dim v as variant
Redim arrByte(1 to n) AS Byte
Redim arrByte1 AS Byte

v=arrByte
arrByte1=v
回复
northwolves 2003-12-10
n=LOF(1)
dim arrByte() AS Byte
dim arrByte1() AS Byte
Get 1, , arrByte
Close 1

arrBytes1 = arrByte
回复
northwolves 2003-12-10
try:

n=LOF(1)
Redim arrByte() AS Byte
Redim arrByte1() AS Byte
Get 1, , arrByte
Close 1

arrBytes1 = arrByte
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7453

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告