运行出错,请问为什么?
////////////////////////////////////////////////////////////Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Dim i As Integer
Dim dx12 As Double  '第一和第二个字符之间的距离
Dim dx23 As Double  '第二和第三个字符之间的距离
Dim dx34 As Double  '第三和第四个字符之间的距离
dx12 = Label2.Left - Label1.Left
dx23 = Label3.Left - Label2.Left
dx34 = Label4.Left - Label3.Left
Label1.Left = X
Label1.Top = Y
Label2.Left = Label1.Left + dx12
Label2.Top = Y
Label3.Left = Label2.Left + dx23
Label3.Top = Y
Label4.Left = Label3.Left + dx34
Label4.Top = Y
Label1.ForeColor = RGB(Ran * 225, Rnd * 255, Rnd * 255)
Label2.ForeColor = RGB(Ran * 225, Rnd * 255, Rnd * 255)
Label3.ForeColor = RGB(Ran * 225, Rnd * 255, Rnd * 255)
Label4.ForeColor = RGB(Ran * 225, Rnd * 255, Rnd * 255)End Sub

解决方案 »

  1.   

    Label1.ForeColor = RGB(Ran * 225, Rnd * 255, Rnd * 255)这几句的ran应该是rnd吧
      

  2.   

    改回来了,但是提示错误的是Label2.Left中的.Left,不知道为什么.错误提示是这样的:
    Compile error:Method or data member not found
      

  3.   

    dx12 = Label2.Left - Label1.Left
      

  4.   

    没有问题的吧集合、对象或用户定义类型不包含引用的成员。该错误发生的原因和解决方法如下: -----对象或成员名称拼写错误。 
    检查名称拼写并检查 Type 语句或对象文档,以确定成员以及对象或成员名称的正确拼写。-----您指定了一个超出范围的集合索引。 
    检查 Count 属性以确定某个集合成员是否存在。注意,集合索引从 1 开始,而不是从 0 开始,因此 Count 属性返回最大可能的索引数。
      

  5.   

    由于我的疏忽,结果造成了控件名出错,因为我对控件进行了复制,然后修改Name,经过你的提示,我发现了问题的所在,谢谢!