我是C程序员,必须做一点VB。我需要初始化一个数组,它不会编译。 这有什么问题,
Dim array() As Integer = {
&H0, &H80, &H2, &H2, &H33, &H0, &H0, &H1A, &H53, &H79, &H51, &H75, &H65, &H73, &H74, &H20
,&H53, &H79, &H4A, &H65, &H74, &H2D, &H53, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20
,&H30, &H31, &H31, &H31}
它具有正确顺序的所有正确字符。 我假设在行的开头有逗号。 VB标准中是否存在使其成为非法的内容?
答案 0 :(得分:1)
在VB中,您需要在行尾使用行继续符_
,或者在逗号之后而不是之前使用换行符。
Dim array() As Integer = {
&H0, &H80, &H2, &H2, &H33, &H0, &H0, &H1A, &H53, &H79, &H51, &H75, &H65, &H73, &H74, &H20,
&H53, &H79, &H4A, &H65, &H74, &H2D, &H53, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20 _
, &H30, &H31, &H31, &H31}
答案 1 :(得分:0)
尝试
Dim array As Integer() = {...}
或者
Dim array = New Integer() {...}
如果这些错误无效,您可以复制错误吗?
答案 2 :(得分:0)
正如我之前的评论所述:
Dim array() As Integer = {
&H0, &H80, &H2, &H2, &H33, &H0, &H0, &H1A, &H53, &H79, &H51, &H75, &H65, &H73, &H74, &H20 _
, &H53, &H79, &H4A, &H65, &H74, &H2D, &H53, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20, &H20 _
, &H30, &H31, &H31, &H31}