几段代码简单的 vb.net 改写成c# 提示错误 请高手 点指
Dim dr As DataGridViewRow = dg.CurrentRow
If dr IsNot Nothing Then
Dim ColumnInfo As ColumnInfo = dr.DataBoundItem
Dim index As Integer = ColumnInfos.IndexOf(ColumnInfo)
If index <> 0 Then
DataGridViewRow dr = dg.CurrentRow;
if (dr != null)
{
ColumnInfo ColumnInfo =
dr.DataBoundItem; int index = ColumnInfos.IndexOf(ColumnInfo);
错误 16 无法将类型“object”隐式转换为“ColumnInfo”。存在一个显式转换(是否缺少强制转换?)
请高手 多多指点
------解决方案--------------------ColumnInfo ColumnInfo = dr.DataBoundItem as ColumnInfo;