我在窗体中有一个gridview。我有checkData.cs
,myNames.cs
文件。 我划分了一些功能,并将这些功能保存在这些.cs文件中。 所有文件都有名称空间myNameSpace
Program.cs文件具有gridview。当我试图从checkData.cs访问gridview时,它显示错误为The data dataGridView1 doesnot exist in the current context
。 如何访问网格视图?如何从一个.cs文件访问GridView到Windows窗体中的另一个.cs文件
Program.cs中我有以下的checkData.cs代码
namespace myNameSpace
{
class Program : System.Windows.Forms.Form
{
private DataGridView dataGridView1;
}
}
文件我想如下访问GridView控件。
namespace myNameSpace
{
public BindToGrid()
{
dataGridView1.dataSource = mySource; //assume that mySource has grid bound data
}
}
在此处张贴一些代码.. –