组合框帮助,将第一个字符设置为默认值 [英] Combo boxes help, set first character to default

查看:126
本文介绍了组合框帮助,将第一个字符设置为默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将组合框中的第一项设置为默认选项。任何人都可以帮我吗?

I want to set the first item in a combo box to the default option. Can anyone help me with that?

推荐答案

设置可能解决问题的必需项目的选定索引
Set selected index for a required item that may be resolve the issue


我hava在这里提出你的问题:组合框帮助,设置第一个字符默认 [ ^ ]





另一种方式:



01:红色

04:绿色

09:蓝色

023:黑色< br $>


initial:



Combo1.Text = Combo1.List(023)
I hava alredy your question here :Combo boxes help, set first character to default[^]


another way:

"01:red"
"04:green"
"09:blue"
"023:black"

initial:

Combo1.Text = Combo1.List("023")


我假设你已经在代码隐藏中绑定了你的组合框。

I assume you have binded your combobox in codebehind.
Dim cmd As New SqlCommand(Query, connection)
Dim dt As New DataTable()
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
Dim dr As DataRow = dt.NewRow()
dr("column name") = "Your default text here"//We created default row that needs to be entered at first position 
dt.Rows.InsertAt(dr, 0)//Inserted at first place
ComboBox.DataSource = dt
ComboBox.DataBind()



问候......:笑:


Regards..:laugh:


这篇关于组合框帮助,将第一个字符设置为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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