VB编一子过程MaxLength(s.MaxWord)出现问题
PrivateSubCommand1_Click()DimsAsString,MaxwordAsStrings=Text1.TextMaxLengths,MaxwordT...
Private Sub Command1_Click()
Dim s As String, Maxword As String
s = Text1.Text
MaxLength s, Maxword
Text2.Text = Maxword
End Sub
Public Function MaxLength(s As String, Maxword As String)
Dim i%, l%
Maxword = ""
Do While s = ""
i = InStr(s, "")
l = Len(s)
word = Left(s, i - 1)
If Len(word) > Len(Maxword) Then
Maxword = word
End If
s = Mid(s, i + 1, l)
Loop
End Function
这个语句 能力出现错误 运行不了 展开
Dim s As String, Maxword As String
s = Text1.Text
MaxLength s, Maxword
Text2.Text = Maxword
End Sub
Public Function MaxLength(s As String, Maxword As String)
Dim i%, l%
Maxword = ""
Do While s = ""
i = InStr(s, "")
l = Len(s)
word = Left(s, i - 1)
If Len(word) > Len(Maxword) Then
Maxword = word
End If
s = Mid(s, i + 1, l)
Loop
End Function
这个语句 能力出现错误 运行不了 展开
1个回答
展开全部
大大的错误,好好看看传值传址吧。MaxLength(s As String, Maxword As String)
s,maxword都是传入的,传出可以用maxlength,也可以用别的变量。
--------------------改成这样试试---------------------
Private Sub Command1_Click()
Dim s As String, Maxword As String
s = Text1.Text
Text2.Text =MaxLength (s, Maxword)
End Sub
Public Function MaxLength(s As String, Maxword As String)as string
Dim i%, l%
Maxword = ""
Do While s = ""
i = InStr(s, "")
l = Len(s)
word = Left(s, i - 1)
If Len(word) > Len(Maxword) Then
Maxword = word
End If
s = Mid(s, i + 1, l)
Loop
MaxLength= Maxword
End Function
s,maxword都是传入的,传出可以用maxlength,也可以用别的变量。
--------------------改成这样试试---------------------
Private Sub Command1_Click()
Dim s As String, Maxword As String
s = Text1.Text
Text2.Text =MaxLength (s, Maxword)
End Sub
Public Function MaxLength(s As String, Maxword As String)as string
Dim i%, l%
Maxword = ""
Do While s = ""
i = InStr(s, "")
l = Len(s)
word = Left(s, i - 1)
If Len(word) > Len(Maxword) Then
Maxword = word
End If
s = Mid(s, i + 1, l)
Loop
MaxLength= Maxword
End Function
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询