Check the datagridview1. Columns. The Count value is 0;
But when I was in the running program, is, indeed, there are data, paste the code below:
The DataSet data1=new DataSet ();
Data1=new ConnectionSql (.) GetItemInfo ();//ConnectionSql () custom class, ConnectionSql () GetItemInfo () returns a DataSet;
Enclosing datagridview1. The DataSource=data1. Tables [0].
This. Datagridview1. Columns [0]. The HeaderText="bar code";//here shows index beyond the scope of the
Console. WriteLine (datagridview1. Columns. The Count);//print here is 0
CodePudding user response:
Delete the error of a line, execute code do have data,
CodePudding user response:
That is also no data when you visit ah. You print is 0, that data is not loaded, change the timing to perform datagridview1. Columns [0]. The HeaderText=... thisCodePudding user response: