我有一个名为DataGridViewHistorical的DataGridView,它有2012到1900年的列。我尝试遍历列标题,并使用年份来查找字符串中的特定日期。因此,在下面的示例中,我将查找2012-01-03, 2011-01-03, 2010-01-03 ... 1900-01-03.
For Each columnYear As DataGridViewColumn In DataGridViewHistorical.Columns
MessageBox.Show(strBuffer.IndexOf(columnYear & "-01-03"))
Next当我运行这段代码时,我得到错误“运算符'&‘没有为类型'System.Windows.Forms.DataGridViewColumn' and 'String'."定义
我怎么才能让它工作呢?
发布于 2013-02-01 01:17:51
我认为您正在寻找DataGridViewColumn的HeaderText属性
MessageBox.Show(strBuffer.IndexOf(columnYear.HeaderText & "-01-03"))https://stackoverflow.com/questions/14631357
复制相似问题