Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 if 条件,例如:
if (e.Item.Cells[7].Text == "something")
但是如何首先检查单元格 [7]是否首先存在?
谢谢...
你可以使用Cells.Count属性。如果它大于 7,则表示Cells[7]存在(因为索引是从零开始的)。
Cells.Count
Cells[7]
if (e.Item.Cells.Count > 7 && e.Item.Cells[7].Text == "something")