c#dataGridView绑定string数组数据源转载
原创// 我们需要用以下方式包装数组。我们需要按如下方式包装数组。
//如果不想要列标题,可以将列标题设置为移除
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form10 : Form
{
public Form10()
{
InitializeComponent();
}
private void button1\_Click(object sender, EventArgs e)
{
Item[] items = new Item[] { new Item("one"), new Item("two"), new Item("three") };
this.dataGridView1.DataSource = items;
}
}
class Item
{
private string _text;
public string Text
{
get { return _text; }
}
public Item(string text)
{
this._text = text;
}
}
}
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
itfan123


