在列表框中添加多个列 [英] Adding Multiple Columns in Listbox

查看:95
本文介绍了在列表框中添加多个列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我想通过3层体系结构将多个列添加到列表框.当前,一切正常,除了只添加一个列而不添加两个列.

Hi there.

I want to add multiple columns to a Listbox through 3-tier architecture. Currently everything works fine except that it only adds one column and not the two.

WORKING CODE (PRESENTATION LAYER)
lstClass = blayer.GetListClass((int)number, (string)name); 
listBox2.DataSource = lstClass;  
listBox2.ValueMember = "classId";
listBox2.DisplayMember = "className"; 


我想同时添加classId和className到列表框.我尝试了多种解决方案,但没有任何效果.有什么建议吗?

关于


I want to add both classId & className to the Listbox. I''ve tried multiple solutions but none work. Any advise please?

Regards

推荐答案

ListBox不支持多列.使用ListView.
ListBox doesn''t support multiple columns. Use a ListView.


listBox1.Items.Add("Class Id \ tClass Name");

当我那样做时,它工作得很好,但是我无法通过3层对多个数据进行处理.谢谢Shameel.我会去的.

问候
listBox1.Items.Add("Class Id\tClass Name");

When i do it that way, it works perfectly fine but i cant do it for multiple data through 3-tier. Thank you Shameel. I will give it a go.

Regards


这篇关于在列表框中添加多个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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