我将用示例快速解释我在找什么。DataGridView C#
说我有一个Employee类
public class Employee
{
int empId;
string empName;
Currency salaryCurrency;
string address;
decimal salaryAmnt;
}
public class Currency
{
string currencyCode;
string currencyName;
int numberOfDecimals;
....
....
}
public class Employees : Collection<Employee>
{
public Employees GetEmployees();
}
在我的表单中我有一个DataGridView dgResult应显示employeeName,salaryAmount和currencyName。 (在货币类别内)。
我有两个问题:
1)我面临的挑战是,在如何引用属性的货币类中。因为我想要currencyName。
2)如何使我的DataGridView只显示这3列。我所做的是将Data Grid View的数据源分配给从GetEmployees函数返回的Employees集合。
dgResult.DatSource = new Employees().GetEmployees();
我正在使用Windows应用程序。
要隐藏某一列,您还可以在想要隐藏其列的属性前放置[[Browsable(false)]]。 – Blorgbeard 2011-01-27 16:11:17