I am designing a user interface to get some input from user where I have added Accpac grid Control on a VB form. I want to restrict user to enter the specific character length in one of the column. I tried everything but didn’t work for me. Is there any way so that I could restrict the Accpac user to enter only specific character length?
We can definitely restrict the user by masking the particular column in the Accpac Grid not at design time but at runtime.
We need to write the following code on Accpac grid’s “OnStartEdit” event, as we need to restrict the user before entering the value.
COLUMN_1 is the AccpacGrid column to which you want to do the masking.
PutSize is to limit the number of characters to 6.
PutPresentationType is to set the presentation mask.
PutPresentationMask is to force each of the 6 characters to uppercase.
CustomField is a AccpacCustomField.
In above code we have restricted user to enter up to 6 alpha numeric [%-6C] value for “COLUMN1” so that user would able to enter only alpha numeric value. Even, if user copies alpha numeric value in small case and paste in particular column then program will automatically convert it into Upper case. Also, program will not allow user to paste non-alpha numeric value in particular column as we have written the code on “OnStartEdit” events.