【发布时间】:2012-07-01 21:30:50
【问题描述】:
大家好,我有 C++ tStringGrid
我想从具有坐标的特定单元格中获取字符串
我试过了,但没有运气:
UnicodeString cell_obj = StringGrid1->Objects[3][2]->ToString();
错误:
Access violation at address 00407617 in module 'NGG_Client.exe'. Read of address 00000000.
请帮忙。
【问题讨论】:
-
你知道网格有多大吗? ie: 3,2 是否越界?
-
是的,我知道它是固定的......
-
@Zac:它正在读取的地址是一个 NULL 指针。可能引用的单元格未初始化。
-
@user525717:你能告诉我们运行时 ColCount 和 RowCount 是什么吗?也许 Objects[3,2] 为空,或者向我们展示更多关于 StringGrid1 的信息(也可能为 NULL)。
-
你的意思是这个对象吗? >>> Form1->StringGrid1->Cells[1][i] = name.c_str(); Form1->StringGrid1->Cells[2][i] = address.c_str();
标签: c++ c++builder vcl tstringgrid