需要有关此代码的帮助 [英] need help with this code
本文介绍了需要有关此代码的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望当文本框文本等于listbox1所选项目时,出现一个味精框
代码如下所示:
如果ListBox1.SelectedItems.Equals(TextBox2.Text)然后
MsgBox("hello",MsgBoxStyle.Information,"HELLO")
WebBrowser1.GoBack()
如果结束
谢谢
i want when the textbox text equals listbox1 selected items then a msg box will appear
here is what the code looks like:
If ListBox1.SelectedItems.Equals(TextBox2.Text) Then
MsgBox("hello", MsgBoxStyle.Information,"HELLO")
WebBrowser1.GoBack()
End If
Thanks
推荐答案
是这个VB6或VB.Net.您必须更具体.
假设它是VB.Net,您想使用
Is this VB6, or VB.Net. You have to be more specific.
Assuming it''s VB.Net, you want to used
if ListBox1.SelectedItem.ToString() = TextBox2.Text Then...
如果它是一个多选列表框,则需要遍历选定的项目,如下所示:
If it''s a multi-aselect listbox, you need to iterate through the selected items, something like this:
foreach item as object in ListBox1.SelectedItems
if (item as string =TextBox2.Text) Then...
继续并进行编码.
Go forth, and code.
这可以做到.
This will do it.
If ListBox1.SelectedItem =TextBox2.Text Then
MsgBox("hello", MsgBoxStyle.Information,"HELLO")
WebBrowser1.GoBack()
End If
这篇关于需要有关此代码的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文