When using the grid of the DEV control, dynamically create columns. If you clear a column with data (including input and empty again ), the system prompts "the format of the input string is incorrect" and finds some solutions to this problem on the Internet. Including the unofficial "huidu Control Network", the method is as follows:
Note: The premise is to set the ColumnEdit of this field to the following RepositoryItemTextEdit
The Code is as follows:
Private void RepositoryItemTextEdit_ParseEditValue (object sender, DevExpress. XtraEditors. Controls. ConvertEditValueEventArgs e)
{
TextEdit edit = (TextEdit) sender;
If (edit. Text = string. Empty)
E. Value = null;
} Another more complex piece of code that another friend gave me was included. I tried both of the two pieces of code to clear them. However, if you click this field, the input box is empty. Although you do not enter any value, the focus is removed and the original data is still in progress. To clear a value, you must enter a value and clear it. This operation is a bit difficult. I don't know why this is the case. Is it because DEV is not the case. I use 9.1.3. The problem had to be solved, so I had to find out what I could do with the following code:
Private void repositoryItemTextEdit1_ParseEditValue (object sender, DevExpress. XtraEditors. Controls. ConvertEditValueEventArgs e)
{
Object obj = e. Value;
If (obj = null | obj. ToString () = string. Empty)
E. Value = null;
}
For more information, see. I have not analyzed the principle.