【发布时间】:2010-10-30 14:19:21
【问题描述】:
我正在尝试编写一个简单的 Compact Framework winforms 应用程序。主窗体有一个绑定到 DataTable 的 DataGrid(包含来自 xml 文件的数据)。我想调出另一个显示当前记录详细信息的表单。我有类似下面的代码作为详细表单的构造函数。
public DetailsForm(DataTable dtLandlords, int Index) //the constructor
{
InitializeComponent();
lLandlordCode.DataBindings.Add("Text", dtLandlords, "LandlordID");
.......
}
我正在使用以下代码调用构造函数
Form frm = new LandlordDetailsForm(dtLandlords, dataGrid1.CurrentRowIndex);
frm.Show();
如何让它显示当前记录(在索引中指定 - 当前未使用),而不仅仅是第一条记录。还是有更好的方法让我这样做?
【问题讨论】:
标签: winforms data-binding compact-framework datatable