比较文本和组合框项目 [英] Compare text with combobox items

查看:64
本文介绍了比较文本和组合框项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
想知道是否有人可以提供以下帮助:
我有一个字符串,需要与组合框中的项目进行比较.这是代码

Hi there,
Wonder if someone can help with the following:
I have a string that need to be compared with items in a combobox. this is the code

For i = 0 To ddlReasons.Items.Count - 1
If ddlReasons.Items(i).ToString = strreason Then
              ShowMessageDialog("This reason is already present",MsgBoxStyle.Information)
              Exit Sub
          End If
     Next



请帮忙..
谢谢



please help..
Thanks

推荐答案

我假设您的组合框为ddlReasons

I am assuming that your combo box is ddlReasons

dim i as integer = 0
i =  ddlreasons.findString(StringVariable)



其中StringVariable是您要查找的字符串.



Where StringVariable is the string that you want to find.


这篇关于比较文本和组合框项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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