日期:2014-05-17 浏览次数:20903 次
通过readAHCIInfo方法里面调用createTableData(),能得到结果(见附件)
但是界面显示一会后就会出现各种异常而导致界面崩溃。
//step2 .创建方法跟委托相匹配的方法
public void readAHCIInfo(int harddiskIndex)
{
Console.WriteLine("readAHCIInfo !!!!!!!!!!!!!!!");
if (!this.dataGridView7.IsDisposed)
{
WinIO winIo = new WinIO(harddiskIndex);
DataTable ahciData = winIo.createTableData();
this.dataGridView7.DataSource = ahciData;
}
}
private DataTable CreateTable()
{
// DataTable的名字
DataTable dt = new DataTable("AHCI");
//给DataTable定列名
DataColumn dtColumn0 = new DataColumn();
dtColumn0.ColumnName = "PortID";
dt.Columns.Add(dtColumn0);
for (int index = 0; index < list_str.Count ; index++)
{
DataColumn dtColumn = new DataColumn();
dtColumn.ColumnName = list_str[index];
dt.Columns.Add(dtColumn);
}