我尝试在 C# 中的 DataGridView 中显示数据,但它根本无法显示任何内容。我的 DataGridView 位于私有静态 void 函数内。
private static void processsub(Event a , Session session)
{
List<String[]> lista = new List<string[]>();
lista.add(new string[] {text1, text2, text3, text4, text5, text6, text7 });
Form1 frm1 = newForm1();
frm1.dataGridView1.AutoGenerateColumns=true;
DataTable table = ConvertListtoDatTable(lista);
frm1.dataGridview1.DataSource = table;
}
我使用消息框窗口来显示“.Row[0].Cell[0].Value.ToString()”,它显示了正确的值,但 DataGridView 只是没有显示数据。
有人有什么建议吗?