日期:2014-05-17  浏览次数:20772 次

出现“用户代码未处理”,求帮助

代码如下:

        private void hiredRoomInfoDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            
            if (hiredRoomInfoDataGridView.Columns[e.ColumnIndex].Name.Equals("ReceiveStatus"))
            {
                if (int.Parse(e.Value.ToString()) == 1)
                e.Value = "已收租";
                else
                e.Value = "未收租";
            }
        }

------解决方案--------------------
if(e!=null&&e.Value!=null)
e.Value=Convert.ToInt32(e.Value)==1?"已收租":"未收租";