Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对于文本框建议收集数据,我无法将数据从datagrid列传输到C#中的数组_C#_C++ - Fatal编程技术网

对于文本框建议收集数据,我无法将数据从datagrid列传输到C#中的数组

对于文本框建议收集数据,我无法将数据从datagrid列传输到C#中的数组,c#,c++,C#,C++,我试图将数据网格中某列的值转换为字符串 我得到的错误类似于“类型为'System.NullReferenceException'的未处理异常”。 我试图做的是将数据集合放入一个集合中,该集合将在文本框中显示其中的内容 这是我的密码;我希望有人能帮助我 我只是个新手,很抱歉,我可能会因为这个问题看起来很愚蠢[pizz] foreach (DataGridViewRow row in dataGridView1.Rows) { xxxx[row.Index] = row.Cells[3].V

我试图将数据网格中某列的值转换为字符串 我得到的错误类似于“类型为'System.NullReferenceException'的未处理异常”。 我试图做的是将数据集合放入一个集合中,该集合将在文本框中显示其中的内容

这是我的密码;我希望有人能帮助我

我只是个新手,很抱歉,我可能会因为这个问题看起来很愚蠢[pizz]

foreach (DataGridViewRow row in dataGridView1.Rows)
{
    xxxx[row.Index] = row.Cells[3].Value.ToString().Trim();
}
for (int x = 10; x <= dataGridView1.RowCount - 1; x++)
{
    collection.Add(xxxx[x].ToString());

}

Search.AutoCompleteCustomSource = collection;
Search.AutoCompleteMode = AutoCompleteMode.Suggest;
Search.AutoCompleteSource = AutoCompleteSource.CustomSource;
foreach(dataGridView1.Rows中的DataGridViewRow行)
{
xxxx[row.Index]=row.Cells[3].Value.ToString().Trim();
}

对于(int x=10;x,我已经找出了我无法从datagrid获取数据的原因,只是我必须在forloops上设置-2,因为源文件是csv文件,索引有点不同

不管怎样,我只是在这里碰碰运气,谢谢

for (int x = 1; x <= dataGridView1.RowCount - 1; x++)
{
    xxxx[x] = dataGridView1.Rows[x].Cells[searchChokoy].Value.ToString(); 
}