愚蠢的ComboBox问题 [英] Silly ComboBox Question

查看:62
本文介绍了愚蠢的ComboBox问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻求解决方案。但是不能弄明白(听起来很简单)。


当您使用ComboBox时,可以选择
启动只需将TEXT设置为Combobox中的valide项目。


我想要做的是根据a选择项目的初始列表项目

varrying veriable。


例如,组合框中填充了一个用户列表。


然后我有一个命令行参数,里面有一个用户名。


应用程序启动,Combobox显示他们的名字。


什么是真正发生的是我做了类似上面的事情。但是我打开MS Access DB(通过ADO)。
。但是用户名不是用户名,而是用户代码编号(例如:Bruce的BRU001,David的DAV001等)


我的组合框列出用户代码。我有一个文本框,根据用户代码显示正确的

用户名(因为它们位于同一数据库行

并且是同步的)。


但是我无法弄清楚如何选择Combobox的初始视图(总是

获得显示的第一个用户代码)。


任何帮助将不胜感激。


问候,


布鲁斯

I''ve been seeking the solution to this. But can''t figure it out (sounds
simple enough).

When you Populat a ComboBox, you can select the initial displayed items on
startup simply by setting the TEXT to a valide item in the Combobox.

What I want to do is to select the initial listed item to an item based upon a
varrying veriable.

For example, the combobox is populated with a list of Users.

I then have a command line argument with a user name in it.

Application starts up and the Combobox shows their name.

What''s really happening is that I do something like the above. But I''m
opening up an MS Access DB (via ADO). But instead of the User name, I have
only a User code number (ie: BRU001 for Bruce, DAV001 for David, etc.)

My combobox lists the User Code. I''ve a Text Box that displays the correct
user name based upon the user code (cause they are on the same data base row
and are in synch).

But I can''t figure out how to select the initial view of the Combobox (always
get the first user code displayed).

Any help will be appreciated.

Regards,

Bruce

推荐答案

嗨先生B.


我总是有点害怕回答你的问题,因为我不是

确定你是否使用了windowforms Combobox或webform Listdropbox。


但是使用windowforms Combobox你可以做

\\\

combobox.selectedindex = combobox.findstring(" name")

///

Cor
Hi Mr B.

I am always a little scared with answering your questions, because I am not
sure if you use the windowforms Combobox or the webform Listdropbox.

But with windowforms Combobox you can do
\\\
combobox.selectedindex = combobox.findstring("name")
///
Cor


我个人会使用combobox.findstringexact(字符串)如果你使用

正常的findtring你得到了冷杉t项目匹配条件(可能是

危险我想)


eric


" Cor" < no*@non.com>在消息中写道

news:u4 ************** @ TK2MSFTNGP09.phx.gbl ...
personally i would use the combobox.findstringexact(string) if you use the
normal findstring you get the first item matching conditions (could be
dangerous i think)

eric

"Cor" <no*@non.com> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
嗨先生B. br />
我总是有点害怕回答你的问题,因为我是
不确定你是否使用了windowforms Combobox或webform Listdropbox。

但是使用了windowforms Combobox你可以做到
\\\
combobox.selectedindex = combobox.findstring(" name")
///
Cor
Hi Mr B.

I am always a little scared with answering your questions, because I am not sure if you use the windowforms Combobox or the webform Listdropbox.

But with windowforms Combobox you can do
\\\
combobox.selectedindex = combobox.findstring("name")
///
Cor



你好EricJ,


我认为你在大多数情况下都是对的,谢谢你让我参加了这个

Cor
Hi EricJ,

I think you are in most cases right, thank you for making me attent on this

Cor


这篇关于愚蠢的ComboBox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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