如何确保ComboBox不选择任何内容...... [英] How to make sure ComboBox select nothing...

查看:90
本文介绍了如何确保ComboBox不选择任何内容......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我遇到了ComboBox的问题。我正试图通过这样做来强制ComboBox选择



myCombo.SelectedText =""

myCombo.SelectedIndex = -1

但是徒劳无功,因为ComboBox会自动选择第一个可用的

选择。


如果我制作了在将.SelectedText设置为"之前,ComboBox可见。并且

.SelectedIndex属性为-1,它将成功。但是如果我把

ComboBox放在TabControl中并且我在TabControl中的Tabs之间切换,那么
ComboBox会自动重新选择第一个可用选项。


任何人都有解决方案吗?


提前致谢。

Hi,

I''m having problem with ComboBox. I''m trying to force the ComboBox select
nothing by doing this,
myCombo.SelectedText = ""
myCombo.SelectedIndex = -1
but in vain, as the ComboBox will automatically select the first available
selection.

If I make the ComboBox visible before setting the .SelectedText to "" and
the .SelectedIndex property to -1, it will be successful. But if I put the
ComboBox in a TabControl and I switch between the Tabs in the TabControl,
the ComboBox will automatically reselect the first available selection.

Anyone out there has a solution?

Thanks in advance.

推荐答案

在组合框选项中添加一个空对象:)


" Programatix" < PR ********* @ nospam.com> escribiónenel mensaje

news:uX ************** @ tk2msftngp13.phx.gbl ...
Add an empty object to the combobox options :)

"Programatix" <pr*********@nospam.com> escribió en el mensaje
news:uX**************@tk2msftngp13.phx.gbl...


我遇到了ComboBox的问题。我正试图通过这样做强迫ComboBox选择
,myCombo.SelectedText =""
myCombo.SelectedIndex = -1
但是徒劳无功, ComboBox将自动选择第一个可用的
选项。

如果我在将.SelectedText设置为"之前使ComboBox可见。并且.SelectedIndex属性为-1,它将成功。但是如果我把
ComboBox放在TabControl中并且我在TabControl中的Tabs之间切换,那么ComboBox会自动重新选择第一个可用选项。

任何人都有一个解决方案?

提前致谢。
Hi,

I''m having problem with ComboBox. I''m trying to force the ComboBox select
nothing by doing this,
myCombo.SelectedText = ""
myCombo.SelectedIndex = -1
but in vain, as the ComboBox will automatically select the first available
selection.

If I make the ComboBox visible before setting the .SelectedText to "" and
the .SelectedIndex property to -1, it will be successful. But if I put the
ComboBox in a TabControl and I switch between the Tabs in the TabControl,
the ComboBox will automatically reselect the first available selection.

Anyone out there has a solution?

Thanks in advance.



您好,


Programatix < PR ********* @ nospam.com> schrieb:
Hello,

"Programatix" <pr*********@nospam.com> schrieb:
我遇到了ComboBox的问题。我正试图通过这样做来强制
ComboBox选择
,myCombo.SelectedText =""
myCombo.SelectedIndex = -1
但是由于ComboBox会自动选择第一个可用的选项。
I''m having problem with ComboBox. I''m trying to force the
ComboBox select
nothing by doing this,
myCombo.SelectedText = ""
myCombo.SelectedIndex = -1
but in vain, as the ComboBox will automatically select
the first available selection.




尝试调用myCombo.SelectedIndex = -1两次,有些时候有帮助。


问候,

Herfried K. Wagner

-

MVP·VB Classic,VB .NET
http://www.mvps.org/ dotnet


如果我将ComboBox绑定到DataSource怎么办?


感谢您的回复。


" Juan C. Olivares" <菊***** @ TAGnet.org>在消息中写道

news:eD ************* @ TK2MSFTNGP10.phx.gbl ...
What if I binded the ComboBox to a DataSource?

Thanks for the respond.

"Juan C. Olivares" <ju*****@TAGnet.org> wrote in message
news:eD*************@TK2MSFTNGP10.phx.gbl...
将空对象添加到组合框选项:)

Programatix < PR ********* @ nospam.com> escribióenel mensaje
新闻:uX ************** @ tk2msftngp13.phx.gbl ...
Add an empty object to the combobox options :)

"Programatix" <pr*********@nospam.com> escribió en el mensaje
news:uX**************@tk2msftngp13.phx.gbl...

选择任何东西,
myCombo.SelectedText =""
myCombo.SelectedIndex = -1
但是徒劳无功, ComboBox将自动选择第一个
可用选项。

如果我在将.SelectedText设置为"之前使ComboBox可见。
和.SelectedIndex属性为-1,它将成功。但是如果我把
的ComboBox放在一个TabControl中并且我在
TabControl中的选项卡之间切换,ComboBox将自动重新选择第一个可用的选项。

任何人都有一个解决方案?

提前致谢。
Hi,

I''m having problem with ComboBox. I''m trying to force the ComboBox select nothing by doing this,
myCombo.SelectedText = ""
myCombo.SelectedIndex = -1
but in vain, as the ComboBox will automatically select the first available selection.

If I make the ComboBox visible before setting the .SelectedText to "" and the .SelectedIndex property to -1, it will be successful. But if I put the ComboBox in a TabControl and I switch between the Tabs in the TabControl, the ComboBox will automatically reselect the first available selection.

Anyone out there has a solution?

Thanks in advance.




这篇关于如何确保ComboBox不选择任何内容......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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