C ++ DataGridView [英] C++ DataGridView
问题描述
我正在尝试将ArrayList绑定到DataGridView,但是在使其正常工作时遇到了问题.我找到了一个C#示例,并尝试将其转换为C ++,但最终得到一个空白的DataGridView.这是我的测试代码:
I'm trying to bind an ArrayList to a DataGridView, and I'm having problems getting it to work correctly. I found a C# example and I tried to convert it to C++, but I end up with a blank DataGridView. This is my test code:
ArrayList ^ list = gcnew ArrayList();
list-> Add(gcnew Developer("Mahesh","Chand",30,"C#,ASP.NET,Windows Forms",10));
list-> Add(gcnew Developer("Michael","Gold",35,"GDI +,ASP.NET",15)));
list-> Add(gcnew Developer("Bhasker","Das",26,"VB.NET,Web应用程序",4));
list-> Add(gcnew Developer("Ashish","Singhal",24,"ADO.NET,GDI +",4)));
list-> Add(gcnew Developer("Neel","Beniwal",3,"C#,ASP.NET,Windows Forms",0));
list-> Add(gcnew Developer("Melanie","Talmadge",25,"Java",2)));
dataGridView1-> DataSource =列表;
dataGridView1-> Refresh();
ArrayList^ list = gcnew ArrayList();
list->Add(gcnew Developer("Mahesh", "Chand", 30, "C#,ASP.NET,Windows Forms", 10)) ;
list->Add(gcnew Developer("Michael", "Gold", 35, "GDI+, ASP.NET", 15)) ;
list->Add(gcnew Developer("Bhasker", "Das", 26, "VB.NET, Web Applications", 4)) ;
list->Add(gcnew Developer("Ashish", "Singhal", 24, "ADO.NET, GDI+", 4)) ;
list->Add(gcnew Developer("Neel", "Beniwal", 3, "C#,ASP.NET,Windows Forms", 0)) ;
list->Add(gcnew Developer("Melanie", "Talmadge", 25, "Java", 2)) ;
dataGridView1->DataSource = list;
dataGridView1->Refresh();
要在C ++中正常工作,是否需要在C ++中执行其他步骤?
Is there an additional step that needs to happen in C++ for this to work correctly?
推荐答案
您是否向网格中添加了列?
did you add columns to the grid?
有关DataGridView类的更多问题,请访问 Windows窗体数据绑定和数据控件论坛.
For more questions about the DataGridView class, visit the Windows Forms Databinding and Data Controls forum.
这篇关于C ++ DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!