将项目添加到组合框 [英] Add item to combobox

查看:81
本文介绍了将项目添加到组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过列表框在组合框中添加项目
注意:Winform主菜单中的组合框和列表框

组合框项目没有显示在组合框的下方,为什么?

纠正标题拼写[/EDIT]

Add Items in Combobox from listbox
Note : Combobox & Listbox in Winform main

Combo box items does not display below of combobox, why?

Title spell corrected [/EDIT]

推荐答案

将项目添加到Items属性

ComboBox.Items属性 [
Add items to the Items property

ComboBox.Items Property[^]

Regards
Espen Harlinn


您试图在Combobox中添加项目的内容.显示您的代码以找出为什么不显示Combobox项的原因.
无论如何,您可以使用给定的代码
What you have tried to add items in Combobox. show your code to find out why Combobox items doesn''t display.

whatever, you can use given code
foreach (object obj in listBox1.Items)
           {
               comboBox1.Items.Add(obj);
           }


您是否已设置Displaymember& Valuemember组合框的属性?

Have you set Displaymember & Valuemember properties of combobox ?

comboBox1.DisplayMember = "Name"; 
comboBox1.ValueMember = "Name";


这篇关于将项目添加到组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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