获取第一个要显示在组合框中的术语,C#? [英] Get the first term to show up in combo box, C#?

查看:63
本文介绍了获取第一个要显示在组合框中的术语,C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在去的大学的编程课上有个作业(全部用C#编写),并且有一个快速的问题.在作业中,我们必须将一个带有几个不同术语的组合框放进去​​.是否可以将列表的第一项设置为默认项 组合框,而不是默认情况下为空白?预先感谢您的帮助.

So I have an assignment in my programming class in at the college I go to (all in C#), and had a quick question. In the assignment we have to put in a combo box with a few different terms. Is it possible to put the first term of the list as the default in the combo box, not just it being blank by default? Thanks in advance for your help.

-falcon0218

-falcon0218

推荐答案

你好falcon0218,

Hello falcon0218,

这是

This is a duplicate of https://social.msdn.microsoft.com/Forums/windows/en-US/1bbfc2b0-f099-4572-be70-e70a27ec2eed/how-to-set-a-default-value-for-a-combo-box?forum=winforms

您只需要使用

MyComboBox.SelectedIndex = 6;  //其中"6"是相对位置.

MyComboBox.SelectedIndex = 6;  // where "6" is the relative position. 

欢呼


这篇关于获取第一个要显示在组合框中的术语,C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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