子过程问题,很简单,帮忙。

lovercat 2002-07-19 05:59:20
Public Function sprs(instr1 As String, out1 As String, out2 As String)
Dim llenstr As Integer

llenstr = InStr(instr1, ";")
out1 = Left(instr1, llenstr - 1)
out2 = Right(instr1, Len(instr1) - llenstr)

End Function

Private Sub Command1_Click()

sprs Label1.Caption, Text1.Text, Text2.Text

End Sub

为什么不执行?
...全文
39 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
supercai 2002-07-19
  • 打赏
  • 举报
回复

Public Function sprs(instr1 As Variant) As Variant
Dim bb(1) As String
Dim llenstr As Integer

llenstr = InStr(instr1, ";")
bb(0) = Left(instr1, llenstr - 1)
bb(1) = Right(instr1, Len(instr1) - llenstr)
sprs = bb

End Function

Private Sub Command1_Click()

Text1 = sprs(Label1.Caption)(0)
Text2 = sprs(Label1.Caption)(1)

End Sub
polarwyp 2002-07-19
  • 打赏
  • 举报
回复
对llenstr = InStr(instr1, ";")有错
YHeng 2002-07-19
  • 打赏
  • 举报
回复
instr(起始位置,准备查找的字符串,要查找的字符串)
lovercat 2002-07-19
  • 打赏
  • 举报
回复
哦,把上边 function应该是sub
asussony 2002-07-19
  • 打赏
  • 举报
回复
怎么会不执行呢?
张友邦 2002-07-19
  • 打赏
  • 举报
回复
llenstr = InStr(instr1, ";")有错
请看仔细一些
lovercat 2002-07-19
  • 打赏
  • 举报
回复
哦,把上边 function应该是sub

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧