VB 6.0 Professional +通过模块执行Left()函数 [英] VB 6.0 Professional + execute Left() function through module

查看:62
本文介绍了VB 6.0 Professional +通过模块执行Left()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿VB帮派!


我之前试图发送此邮件但失败了。看到一个新手的介绍:-)


无论如何,我希望找到解决问题的捷径。修改一个文本阅读器软件,它应该只选择我告诉它的单词Bicycle。举个例子:


我的表格


Dim GoSplit As Variant

Dim strGetWords As String


FileName =" \ usermate.txt"

f = FreeFile

打开App.Path + FileName输入为1

请勿做EOF(f)

行输入#1,strLine

GoSplit =拆分(strGetWords,"")


如果是InStrB(strGetWords $," bicycle")<> 0然后


''左()会拾起自行车

''InStrB正在抓住一切,只要有点'像摩托车一样


Text2(0).Text ="自行车>


我应该在这里使用了Left()。尽管如此,我没有时间修改代码,我的客户每周都会离开测试它。


我的模块


Dim MyStr As变种

Dim GrabMore As String

Public Sub SendOnly()

GrabMore = LyricalContentfind.Text2(0).Text

MyStr =左(GrabMore,7)

''希望只抓住自行车'的7个字符

''暂时我也开始周期"不在代码中...

''我在文本中找到摩托车时会得到循环。


如果离开(GrabMore,7)<> ; ""然后''第一个值执行

LyricalContentfind.Text2(0).Text =" Bicycle"

Else

MsgBox(这里没有话语好玩的男孩!)


''只有在没有单词的情况下被发现,应该如上所述


LyricalContentfind.Text2(0).Text =""


结束如果


结束子


如果你能指出我的解决方案,它会很好。我也是一个VB粉丝,宁愿让代码做我想做的。任何形式的提示都表示赞赏。祝所有人过得愉快!


D?k?ll

Hey VB Gang!

I attempted to send this previously but failed. behold the introduction of a newbie :-)

Anyway, I am hoping t find a shortcut to fixing a problem. Modifying a text reader software which is supposed to pick only the words I tell it, "Bicycle" as one example:

My form

Dim GoSplit As Variant
Dim strGetWords As String

FileName = "\usermate.txt"
f = FreeFile
Open App.Path + FileName For Input As 1
Do While Not EOF(f)
Line Input #1, strLine
GoSplit = Split(strGetWords, " ")

If InStrB(strGetWords$, "bicycle") <> 0 Then

''Left() would have picked up "Bicycle"
''InStrB is grabing everything in sight, provided the''re somewhat alike like motorcycle

Text2(0).Text = "Bicycle"
End If

I should have used Left() here. Nonetheless I do not have the time to modify the code, my client leaves in aweek to test it.

My Module

Dim MyStr As Variant
Dim GrabMore As String
Public Sub SendOnly()
GrabMore = LyricalContentfind.Text2(0).Text
MyStr = Left(GrabMore, 7)
''hoping to grab only bicyle''s 7 characters
''for the time being I am also gettin "cycle" NOT IN THE CODE...
''I get cycle when motocycle is found in the text.

If Left(GrabMore, 7) <> "" Then ''first value performed
LyricalContentfind.Text2(0).Text = "Bicycle"
Else
MsgBox("No words here fun boy!")

''only if there are no words were found, should above come up

LyricalContentfind.Text2(0).Text = ""

End If

End Sub

If you can point me to a solution, it would be great. I am also a VB fan, and would rather make the code do what I want. Any sort of hints you have is appreciated. Have a great week All!

D?k?ll

推荐答案

," bicycle")<> 0然后


''左()会拾起自行车

''InStrB正在抓住一切,只要有点'像摩托车一样


Text2(0).Text ="自行车>


我应该在这里使用了Left()。尽管如此,我没有时间修改代码,我的客户每周都会离开测试它。


我的模块


Dim MyStr As变种

Dim GrabMore As String

Public Sub SendOnly()

GrabMore = LyricalContentfind.Text2(0).Text

MyStr =左(GrabMore,7)

''希望只抓住自行车'的7个字符

''暂时我也开始周期"不在代码中...

''我在文本中找到摩托车时会得到循环。


如果离开(GrabMore,7)<> ; ""然后''第一个值执行

LyricalContentfind.Text2(0).Text =" Bicycle"

Else

MsgBox(这里没有话语好玩的男孩!)


''只有在没有单词的情况下被发现,应该如上所述


LyricalContentfind.Text2(0).Text =""


结束如果


结束子


如果你能指出我的解决方案,它会很好。我也是一个VB粉丝,宁愿让代码做我想做的。任何形式的提示都表示赞赏。祝所有人过得愉快!


D?k?ll
, "bicycle") <> 0 Then

''Left() would have picked up "Bicycle"
''InStrB is grabing everything in sight, provided the''re somewhat alike like motorcycle

Text2(0).Text = "Bicycle"
End If

I should have used Left() here. Nonetheless I do not have the time to modify the code, my client leaves in aweek to test it.

My Module

Dim MyStr As Variant
Dim GrabMore As String
Public Sub SendOnly()
GrabMore = LyricalContentfind.Text2(0).Text
MyStr = Left(GrabMore, 7)
''hoping to grab only bicyle''s 7 characters
''for the time being I am also gettin "cycle" NOT IN THE CODE...
''I get cycle when motocycle is found in the text.

If Left(GrabMore, 7) <> "" Then ''first value performed
LyricalContentfind.Text2(0).Text = "Bicycle"
Else
MsgBox("No words here fun boy!")

''only if there are no words were found, should above come up

LyricalContentfind.Text2(0).Text = ""

End If

End Sub

If you can point me to a solution, it would be great. I am also a VB fan, and would rather make the code do what I want. Any sort of hints you have is appreciated. Have a great week All!

D?k?ll


嗨D?k?ll。


对不起,但也许我有点慢 - 我无法确切地知道问题是什么。您能否尝试简要介绍一下您希望代码执行的操作,在这种情况下,或许您不希望它做什么?
Hi D?k?ll.

Sorry, but maybe I''m a little slow - I just could not make out exactly what the problem is. Could you please try to give us a brief summary of what you want the code to do, and in this case perhaps what you don''t want it to do?



行输入#1,strLine

GoSplit =拆分(strGetWords,"")


D?k?ll
Line Input #1, strLine
GoSplit = Split(strGetWords, " ")

D?k?ll



您期望在strGetWords中找到什么?

您刚刚声明了此变量并且没有任何内容。

Hi, what exactly do you expect to find in strGetWords?
You have just declared this variable and stored nothing in it.


这篇关于VB 6.0 Professional +通过模块执行Left()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆