473,385 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Numeric UpDown

Hello
I would like to set a NumericUpDown control to readonly and I don't want
it to response on klicks on the arrows.
I set the ReadOnly property to false and the InterceptArrowKeys to false
too.

myNumericUpDown.ReadOnly = false;
myNumericUpDown.InterceptArrowKeys = true;

The result is that the control looks like ReadOnly but the arrow buttons
still work and can change the value. And I think this shouldn't be
possible.

Thanks
Ferdinand
Dec 15 '05 #1
9 2956
myNumericUpDown.Enabled = false ???

Dec 15 '05 #2
>From the documentation for UpDownBase.ReadOnly:

"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #3
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #4
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #5
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #6
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #7
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #8
But with InterceptArrowKeys set to false it is still changable with the
Arrowkeys.
I don't want to Use enabled=false becuase then you cannot copy the
number to paste it somewhere else.

Thanks
Ferdinand

Bruce Wood wrote:
From the documentation for UpDownBase.ReadOnly:


"true if the text can be changed by the use of the up or down buttons
only; otherwise, false. The default value is false."

"By setting the ReadOnly property to true, you will eliminate the need
for much validation of the Text property. The user will be restricted
to the use of the up and down buttons to change the Text values. It
will only allow them to select values you specify."

So, basically, the ReadOnly property doesn't do what you think it does
(or, for that matter, what the name implies that it does... stupid
behaviour for a property named ReadOnly, IMHO, but there you go).

Dec 16 '05 #9
Let's back up a second, here.

A read-only text box that the user can't modify is really just a
ReadOnly TextBox with some useless buttons beside it. Why, exactly, do
you want those useless buttons there?

The only thing that comes to my mind is that you want a value that the
user can change in some situations, but which is read-only in other
situations. If that's the case, then there's an easy solution.

Place _two_ controls that that place on your form. One, a NumericUpDown
control; the other, a TextBox with ReadOnly set to true. Populate both
with your value, all the time. When you want the user to be able to
manipulate the value, Hide() the TextBox and Show() the NumericUpDown
control. When you want it to be read-only, Show() the TextBox and
Hide() the NumericUpDown control.

If you really want to be clever, create a UserControl of your own that
contains a NumericUpDown control and a TextBox that act this way
depending upon the setting of the ReadOnly property on your
UserControl. Lots more work, though, as you have to reproduce the
public contract of the NumericUpDown in your UserControl.

I wouldn't bother trying to bend NumericUpDown to your will. Just play
tricks behind the scenes to use a different control in ReadOnly
situations.

Dec 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Travis Oliphant | last post by:
Numarray is making great progress and is quite usable for many purposes. An idea that was championed by some is that the Numeric code base would stay static and be replaced entirely by Numarray. ...
2
by: Johannes Nix |Johannes.Nix | last post by:
Hi, I have a tricky problem with Numeric. Some time ago, I have generated a huge and complex data structure, and stored it using the cPickle module. Now I want to evaluate it quickly again on a...
4
by: Gezeala 'Eyah' Bacu\361o II | last post by:
hey guys..need your help on this.. i have a plpgsql function where in i compute numeric values for my php scripts.. my problem is my function just won't round some numbers properly.. what i...
1
by: Qumer Mumtaz | last post by:
h I am using updown domain counter.I have following things in item collection of the control {3 day,2 day,1 day}.When I execute the program and press up button of domain counter nothing is happened....
2
by: Just Me | last post by:
I need a numerical updown control that displays fractions. If the increment is 1/16 it would display 1/16, 1/32, 3/16, 1/4... I thought I might inherit from a NumericalUpDown control and place...
6
by: M.A. Oude Kotte | last post by:
Hi All, I hope this is the correct mailing list for this question. But neither postgresql.org nor google could help me out on this subject. I did find one disturbing topic on the mailing list...
7
by: Sheldon | last post by:
Hi, I have the following loop that I think can be written to run faster in Numeric. I am currently using Numeric. range_va = main.xsize= 600 main.ysize= 600 #msgva is an (600x600) Numeric...
0
by: robert | last post by:
just a note - some speed comparisons : 0.60627370238398726 0.42836673376223189 0.36965815487747022 0.016557970357098384 0.15692469294117473 0.01951756438393204
13
by: nishit.gupta | last post by:
Is their any fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" Thnx
12
by: remya1000 | last post by:
how can i select time (hours,minutes,second) in updown arrow buttons in VB.NET. as we have current time displayed in date and time properties in our system. in date and time properties, while...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.