How to hide the up and down arrow in a DataGridViewTextBoxColumn with InputType.Type is Number ?

Answered
0
0

Hello,

I would like to have cells that allow a user to enter decimal values, and prohibit characters other than numbers and the decimal separator. The NumericUpDown control is very uncomfortable, so I use this column:

public abstract class NumericColumn : DataGridViewTextBoxColumn
{
    public NumericColumn() 
    {
        InputType.Type = TextBoxType.Number;
        // ... other stuff ...
    }
}

This meets perfectly my needs, expect for the up an down arrows that come with the HTML Input Type being rendered. I want to get rid of these arrows.

How can I proceed ?

Thank you very much. By the way, I really like working with WiseJ a lot, it really deserves to be known.

  • You must to post comments
Best Answer
0
1

Hi Laurent

Good news!!

A colleague gave me some tips to be able to hide the arrows in the number cell.
These are

1) Use CSS to hide the arrows. Add this to Default.html in a style tag:
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}

2) Set InputType.Type to Text, InputType.Mode to Numeric (shows numeric soft keyboard on iOS and Android, no input filtering), and apply a RegEx filter (Filter property).

3) Use a MaskedTextBox with InputType.Mode = “Number” and a custom mask: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.maskedtextbox.mask?view=net-5.0#system-windows-forms-maskedtextbox-mask

I attached a sample that covers the number 1

Regards and happy coding

 

  • Laurent
    Perfect ! I Thank you very much.
  • You must to post comments
0
0

Hi Laurent

Unfortunately, these type checks for InputType and all related settings are entirely native and managed by the browser
Our development team will considere this as an enhancement in future release.

Thanks and happy coding

  • You must to post comments
0
0

Hi Laurent

Thank for write us

What version of Wisej are you working?

Regards

  • Laurent
    Hi Paul I am using the very last one : 2.2.53
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.