VB 6.0中的数组换行符

时间:2013-09-25 18:51:19

标签: vb6

我想询问如何打破数组的行。当我遇到这个时,我正在做问卷调查。我只想简单地打破代码的行,这样它就不会很长

我不知道从哪里开始,所以这是我的第一个代码:

  Public Sub showQuestion()
    Dim letter
    Dim X As Integer
    Dim Y As Integer

Randomize
question = Array("A programming language originally developed by James Gosling at Sun Microsystems", "A programming language from Microsoft", "Determines when the user wants to do something such as exit the application or begin printing", "Property information", "GUI information and private code")
answer = Array("Java", "Visual_Basic", "Command_Button", "Property_page", "Form")

question = Array("Specifies the background color of the control", "Generally, specifies whether or not a control has a border", "Determines whether or not the control can respond to user-generated events", "For controls displaying text, specifies the font (name, style, size, etc.) to be applied to the displayed text")
answer = Array("BackColor", "BorderStyle", "Enabled", "Font")

question = Array("Specifies the color of text or graphics to be displayed in the control", "Specifies the height of the control in pixels", "The string value used to refer to the control in code", "Specifies the graphic to be displayed in the control")
answer = Array("ForeColor", "Height", "Name", "Image")

qno = Int(Rnd * (UBound(question) + 1))
ReDim ans(Len(answer(qno)), 2)

lblquestion.Caption = question(qno)

For X = 0 To Len(answer(qno)) - 1
    ans(X, 1) = Mid$(answer(qno), X + 1, 1)

Next X

For Y = 0 To Len(answer(qno)) - 1
    If ans(Y, 1) = "_" Then
        ans(Y, 2) = Chr$(32)
    Else
        ans(Y, 2) = "*"
    End If
Next Y

loadHint
End Sub

1 个答案:

答案 0 :(得分:2)

根据您的澄清,您可以使用下划线(_)来打破这一行。

question = Array("A programming language originally developed by James Gosling at Sun Microsystems", _
                 "A programming language from Microsoft", _
                 "Determines when the user wants to do something such as exit the application or begin printing", _
                 "Property information", "GUI information and private code")  

answer = Array("Java", "Visual_Basic", "Command_Button", _
               "Property_page", "Form")