vb程序中缺少子程序,函数或属性,怎么办? 5

PrivateSubCommand1_Click()DimIAsInteger,M0AsSingle,TextLienAsString,X()AsSingle,Y()As... Private Sub Command1_Click()
Dim I As Integer, M0 As Single, TextLien As String, X() As Single, Y() As Single

CommonDialog1.Filter = "Metafile (*.*)|*.*"
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
Text1.Text = CommonDialog1.FileName
M0 = 0: f0 = 0: Fn = 0
Do Until EOF(1)
Line Input #1, TextLien: M0 = M0 + 1
Loop
Seek #1, 1

ReDim X(M0), Y(M0)
For I = 1 To M0
Input #1, X(I), Y(I)
Next I
Close 1

End Sub

Private Sub Command2_Click()
Dim YiYuanHuiGui As Integer
Dim B0 As Single, B1 As Single, r As Single
Call YiYuanHuiGui
Text2.Text = B0
Text3.Text = B1
Text4.Text = r

End Sub
Function YiYuanHuiGui(AX, AY, n, Y0, B0, B1, r) As Integer
Dim I As Integer, J As Integer
Dim SX As Single, SY As Single, EX As Single, EY As Single
Dim Lxx As Single, Lyy As Single, Lxy As Single
C = 0: d = 0
For I = 1 To n
SX = SX + AX(I): SY = SY + AY(I)
Next
EX = SX / n: EY = SY / n
Lxx = 0: Lyy = 0: Lxy = 0
For I = 1 To n
Lxx = Lxx + (AX(I) - EX) ^ 2
Lyy = Lyy + (AY(I) - EY) ^ 2
Lxy = Lxy + (AX(I) - EX) * (AY(I) - EY)
Next
B1 = Lxy / Lxx: B0 = EY - B1 * EX
r = Lxy / (Lxx * Lyy) ^ 0.5
End Function
问题定位在Call YiYuanHuiGui
已经请高手帮忙解决了,谢谢各位了。
新手提问都不是很明确,以后会注意,会努力学习的
展开
 我来答
hsf0012
2009-04-16 · 超过26用户采纳过TA的回答
知道答主
回答量:142
采纳率:37%
帮助的人:37.3万
展开全部
Private Sub Command2_Click()
Dim YiYuanHuiGui As Integer
Dim B0 As Single, B1 As Single, r As Single
Call YiYuanHuiGui
Text2.Text = B0
Text3.Text = B1
Text4.Text = r

End Sub

call YiYuanHuiGui '是调用自定义过程"YiYuanHuiGui"的意思,
所以不有和自定义的整形变量Dim YiYuanHuiGui As Integer 同名,
至于:
Text2.Text = B0
Text3.Text = B1
Text4.Text = r
如果想把文本框的内容赋值给那三个变量的话,应该写成:
BO=text2.text
B1=text3.text
r=text4.text
否则返回的是空字符串...
刀成朝1
2009-04-16 · TA获得超过1334个赞
知道大有可为答主
回答量:763
采纳率:0%
帮助的人:697万
展开全部
删掉Private Sub Command2_Click() 中的 Dim YiYuanHuiGui As Integer 他与函数同名
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
司徒惊月
2009-04-16 · TA获得超过1726个赞
知道大有可为答主
回答量:4186
采纳率:0%
帮助的人:1602万
展开全部
错误定位在哪行?这样看代码很晕的。。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式