C# 怎么用按钮控制combobox的下拉动作和选择
语言c#在VS2008编写的windows窗体程序中运用点击自己创建的多个按钮来操控combobox的动作实现combobox的下拉,内容选择,内容确认不用连数据库按钮包...
语言c#在VS2008编写的windows窗体程序中运用点击自己创建的多个按钮来操控combobox的动作实现combobox的下拉,内容选择,内容确认不用连数据库按钮包括:上,下,确认,三个可加我Q:554642877详细说下,谢谢各位大虾!!!!帮帮我吧!
展开
1个回答
推荐于2018-03-23
展开全部
界面上放一个combox,3个按钮,分别叫btnUp, btnDown, btnconfirm private void btnUp_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex <=0)
return;
comboBox1.SelectedIndex = comboBox1.SelectedIndex -1;
} private void btnDown_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex >= comboBox1.Items.Count - 1)
return;
comboBox1.SelectedIndex =comboBox1.SelectedIndex +1;
} private void btnConfirm_Click(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.Text);
}
{
if (comboBox1.SelectedIndex <=0)
return;
comboBox1.SelectedIndex = comboBox1.SelectedIndex -1;
} private void btnDown_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex >= comboBox1.Items.Count - 1)
return;
comboBox1.SelectedIndex =comboBox1.SelectedIndex +1;
} private void btnConfirm_Click(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.Text);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询