numericupdown

Windows Forms - customizing NumericUpDown to be nullable

两盒软妹~` 提交于 2019-12-24 11:53:33
问题 I found this custom class that allows NumericUpDown to receive nullable values. I use it in an edit form which can be empty or could be populated with a data from a database from where the need for nullable values comes from. This is the current code : public partial class NullableNumericUpDown : NumericUpDown { public NullableNumericUpDown() { InitializeComponent(); } public NullableNumericUpDown(IContainer container) { container.Add(this); InitializeComponent(); } private int? _value;

Stagger increments in C# NumericUpDown control

岁酱吖の 提交于 2019-12-22 18:48:49
问题 I am facing some trouble trying to configure a particular configuration for a NumericUpDown control in c#. Basically, I have seen that I can set the Increment interval, but I would like to manage the Increment interval depending on which arrow is clicked (up or down). I have checked the events of the control, but I do not find an event for each arrow. Basically, I want to achieve a control where, at different values, the increment is different. from 0.00 to 5.00 increments of 0.01, from 5.00

Stagger increments in C# NumericUpDown control

天大地大妈咪最大 提交于 2019-12-22 18:48:05
问题 I am facing some trouble trying to configure a particular configuration for a NumericUpDown control in c#. Basically, I have seen that I can set the Increment interval, but I would like to manage the Increment interval depending on which arrow is clicked (up or down). I have checked the events of the control, but I do not find an event for each arrow. Basically, I want to achieve a control where, at different values, the increment is different. from 0.00 to 5.00 increments of 0.01, from 5.00

NumericUpDown: accept both comma and dot as decimal separator

丶灬走出姿态 提交于 2019-12-21 12:38:00
问题 There's a way to force c# NumericUpDown to accept both comma and dot, to separate decimal values? I've customized a textbox to do it (practically replacing dots with commas), but I'm surprised that there isn't another way.. This question explains how to change the separator, but I would like to use both! 回答1: NumericUpDown control uses the culture of the operating system to use comma or dots as a decimal separator. If you want to be able to handle both separators and consider them as a

NumericUpDown backcolor not working as expected

时间秒杀一切 提交于 2019-12-20 03:23:35
问题 I recently had the need to write a version of the Windows NumericUpDown control which could highlight whether a value was mandatory. It needed to do this by changing the back colour of the control. I thought this would be simple enough, but in trying to do so, I find that it has a wierd side-effect of not quite drawing all the control. Using the code below, I am seeing this: When I drop a control on a Windows form, and change the BackColor property (ie. to Blue) , the whole of the control's

c# WinForms can you get the NumericUpDown text area

蓝咒 提交于 2019-12-19 12:03:47
问题 Is it possible to get the text area of a NumericUpDown control? I'm looking to get it's size so that I can mask it with a panel. I don't want the user to be able to edit AND select the text. Is this possible? Or is there another way of covering up the text in the text box? Thanks. 回答1: You can get this by using a Label control instead of the baked-in TextBox control. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto

Android having NumericUpDown Button?

主宰稳场 提交于 2019-12-18 05:44:12
问题 I've tried to find the NumericUpDown button in Android, but failed. Do you know what the controller is called in Android - please let me know! <?xml version="1.0" encoding="utf-8"?> <!-- main.xml 7/22 2010 --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <GridView android:id="@+id/GridView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numColumns="3" android

C# NumericUpDown.OnValueChanged, how it was changed?

天涯浪子 提交于 2019-12-14 03:58:47
问题 I would like to ask how to make custom EventArgs for existing event handler. Lets say, that I have NumericUpDown numericUpDown control and I want handler for its OnValueChanged event. Double clicking to ValueChanged in visual studio makes snippet like this private void numericUpDown_ValueChanged(object sender, EventArgs e) { } However, I'd like to know how it was changed (like +5, -4.7), but plain EventArgs does not have this information. Maybe Decimal change = Value - Decimal.Parse(Text)

C# Decimal to double?

我只是一个虾纸丫 提交于 2019-12-12 03:33:05
问题 Why can't I use math.pow with numericUpDown value? When I use this code: a = (numericUpDown1.Value); b = (numericUpDown2.Value); m = Math.Pow(a, b); I receive the following error: Severity Code Description Project File Line Suppression State Error CS0266 Cannot implicitly convert type 'decimal' to 'double'. An explicit conversion exists (are you missing a cast?) 回答1: This is because Math.Pow has only one overload - the one accepting two double s. Since you want to work with decimal s, you

change decimal place in textbox using numericUpDown

余生颓废 提交于 2019-12-12 01:24:26
问题 Im using Visual Studio 2010, windows form (c#). I need change decimals place of value in textbox using numericUpDown1. example: I tryed this code: private void numericUpDown1_ValueChanged(object sender, EventArgs e) { // tbxConvertito.Text = (decimal.Parse(tbxConvertito.Text) * 10m).ToString(); if (numericUpDown1.Value == 0) { int decimalPlace = 0; // Decimal xDecimal = decimal.Parse(tbxConvertito.text); decimal xDecimal = decimal.Parse(tbxConvertito.Text); tbxConvertito.Text = (Math.Round