vb,为什么“和"不起作用? [英] vb, why does 'and' not work?

查看:114
本文介绍了vb,为什么“和"不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在制作一个从文本框中搜索特定单词的程序.以下代码搜索一个单词并找到它:



i am making a programme that seraches for a particular word from a text box. the following code searches for a word and it finds it:

Dim r As Integer

        TextBox1.Text = "i am a href page"
        TextBox2.text = "href"
        r = TextBox1.Text.IndexOf(TextBox2.Text)
        If r > 0 Then
            MsgBox("Found word, " & r & " characters into the search string.")
        Else
            MsgBox("Sorry, could not find the search text")
        End If



但是如果我添加进度条并使用以下代码告诉vb等待进度条填满并检查单词,则找不到单词:



but if i add a progress bar and use following code to tell vb to wait for the progress bar to fill up and check the word, it doesn''t find the word:

Dim r As Integer

        TextBox1.Text = "i am a href page"
        TextBox2.text = "href"
        r = TextBox1.Text.IndexOf(TextBox2.Text)
        If Checking_Site.Value = Checking_Site.Maximum And r > 0 Then
            MsgBox("Found word, " & r & " characters into the search string.")
        Else
            MsgBox("Sorry, could not find the search text")
        End If



这是什么原因?

p.s.在上面的代码"checking_site"中是我的进度条的名称.

预先感谢您提供的任何帮助.



what is the reason for this?

p.s. in the above code ''checking_site'' is the name of my progress bar.

thanks in advance for any help given

推荐答案

Checking_Site.Value不能等于Checking_Site.Maximum.您是否逐步调试了调试器以查看其内容?您的代码不是在等待进度条,而是说如果进度条已立即完成,请找到单词,否则就说您不能.
Checking_Site.Value must not equal Checking_Site.Maximum. Did you step through the debugger to see what it was ? Your code is not waiting for the progress bar, it''s saying ''if the progress bar is finished RIGHT NOW, find the word, otherwise say you couldn''t.


这篇关于vb,为什么“和"不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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