在DataGridView列中格式化输入

时间:2013-11-22 06:39:55

标签: c# datagridview

是否可以使用maskeditbox在特定的datagridview列中进行自定义输入?

我试过了:

private void dgLokacije_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (dgLokacije.CurrentCell.ColumnIndex == 0) 
            {                   
                MaskedTextBox prodCode = e.Control as MaskedTextBox;
                prodCode.Mask = "00000-9999";

            }
        }

但是我遇到错误Object reference not set to an instance of an object.在线prodCode.Mask = "00000-9999";

0 个答案:

没有答案