Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

How to hide the numericUpDown control's up and down arrows?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ABC - 05 Jul 2006 16:35 GMT
How to hide the numericUpDown control's up and down arrows?

I only want the numeric textbox, but numericUpDown has up and down arrow is
not my want, how can I hide it?
Jared Parsons [MSFT] - 05 Jul 2006 18:47 GMT
Hello ABC,

> How to hide the numericUpDown control's up and down arrows?
>
> I only want the numeric textbox, but numericUpDown has up and down
> arrow is not my want, how can I hide it?

I don't think that you can hide the arrows on the NumericUpDown control.  

--
Jared Parsons [MSFT]
jaredpar@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights
Bob Powell [MVP] - 05 Jul 2006 22:20 GMT
Just use a text box!

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> How to hide the numericUpDown control's up and down arrows?
>
> I only want the numeric textbox, but numericUpDown has up and down arrow
> is not my want, how can I hide it?
ABC - 06 Jul 2006 05:55 GMT
but if I use textbox, it will accept any non-numeric characters.

"Bob Powell [MVP]" <bob@_spamkiller_.bobpowell.net> ¼¶¼g©ó¶l¥ó·s»D:OFj%23ajHoGHA.4352@TK2MSFTNGP02.phx.gbl...
> Just use a text box!
>
>> How to hide the numericUpDown control's up and down arrows?
>>
>> I only want the numeric textbox, but numericUpDown has up and down arrow
>> is not my want, how can I hide it?
Claes Bergefall - 06 Jul 2006 15:57 GMT
Public Class TextBoxEx
   Inherits TextBox
   Private Const ES_NUMBER As Integer = &H2000

   Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams
       Get
           Dim params As CreateParams = MyBase.CreateParams
           params.Style = params.Style Or ES_NUMBER
           Return params
       End Get
   End Property

   Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
       If keyData = (Keys.Shift Or Keys.Insert) OrElse keyData =
(Keys.Control Or Keys.V) Then
           Dim data As IDataObject = Clipboard.GetDataObject
           If data Is Nothing Then
               Return MyBase.ProcessCmdKey(msg, keyData)
           Else
               Dim text As String =
CStr(data.GetData(DataFormats.StringFormat, True))
               If text = String.Empty Then
                   Return MyBase.ProcessCmdKey(msg, keyData)
               Else
                   For Each ch As Char In text.ToCharArray
                       If Not Char.IsNumber(ch) Then
                           Return True
                       End If
                   Next
                   Return MyBase.ProcessCmdKey(msg, keyData)
               End If
           End If
       Else
           Return MyBase.ProcessCmdKey(msg, keyData)
       End If
   End Function
End Class

 /claes

> but if I use textbox, it will accept any non-numeric characters.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.