Hi @Shahab a ,
To implement a custom DataGridView
in VB.NET that supports the features you described (i.e., numeric and decimal validation, and a button appearing when the cell is focused), you will need to create a custom DataGridViewColumn
and DataGridViewCell
. Here's how you can approach the solution:
- Numeric and Decimal Validation:
- You can create custom column properties like
IsNumeric
andIsDecimal
in a derivedDataGridViewTextBoxColumn
. - Override the
EditingControlShowing
event to enforce numeric and decimal input.
- You can create custom column properties like
- Button Appearance on Focus:
- You will need a combination of a
DataGridViewTextBoxCell
and a button. The button will appear dynamically when the cell is focused, and it will disappear when the focus is lost. - Use a
DataGridView
custom column and cell to handle the dynamic button display logic.
- You will need a combination of a
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.