运行时错误“6":Visual Basic [英] Run time Error '6':Visual Basic

查看:52
本文介绍了运行时错误“6":Visual Basic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Basic 6
我有以下代码结构:
FUNCNINFO 是一个结构体

I am using Visual Basic 6
I have the following code structure:
FUNCNINFO is a structure

Public funcTable() As FUNCNINFO
-----
------
ReDim Preserve funcTable(0 To upsize + ns)

当 (upsize + ns) 的值超过 32766 时,会给出运行时溢出错误 '6'您知道原因和解决方案吗?

When the value of (upsize + ns) is exceeding 32766,it is giving the runtime overflow error '6' Do you have any idea of the cause and the solution?

推荐答案

VB6 的 Integer 类型是 16 位,所以不能存储大于 32767 的值,它的 Long 是 32位整数类型,因此以下将起作用;

VB6's Integer type is 16 bits so cannot store a value > 32767, its Long that's the 32 bit integer type so the following will work;

Dim upsize As Long
Dim ns As Long

upsize = 32766
ns = 12345

ReDim Preserve funcTable(0& To upsize + ns)

这篇关于运行时错误“6":Visual Basic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆