如何设置 VB.Net ComboBox 默认值 [英] How do I set a VB.Net ComboBox default value

查看:60
本文介绍了如何设置 VB.Net ComboBox 默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到使组合框中的第一项可见的正确方法.

I can not locate the correct method to make the first item in a combo box visible.

应用以一个空的组合框开始.用户进行单选框选择,然后单击 Go!(多么原始).组合框通过 LDAP 查询加载.所有这些都运行良好.问题是组合框对用户来说仍然是空的.他们必须单击箭头才能看到选项.

The app starts with an empty combo box. The user makes a radio box selection then clicks Go! (how original). The combo box is loaded via an LDAP query. All this is working just fine. The problem is the combo box still appears to the user to be empty. They must click the arrow to see the options.

如何在用户点击 Go! 后使第一个选项可见"?

How do I make the first option 'visible' after the users clicks Go!?

推荐答案

 ' Your code filling the combobox '
 ...

 If myComboBox.Items.Count > 0 Then
     myComboBox.SelectedIndex = 0    ' The first item has index 0 '
 End If

这篇关于如何设置 VB.Net ComboBox 默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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