473,406 Members | 2,710 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,406 software developers and data experts.

VS2005 - Passing NumericUpDown into a class method?

I am trying to pass a NumericUpDown object into a class method using Visual
Studio 2005, but the control type is

not found in Intellisense and the type declaration is flagged as an error.
Here is a code sample (which doesn't

work):

*** Begin code ***

Imports System.Windows.Forms
Imports System.Net

Public Class ConfigurationClass

Private Sub LoadPortSetting ( byVal newVal as UShort, _
byVal cntrl as NumericUpdown)
cntrl.Value = newVal
End Sub

End Class

*** End code ***
Note that if I change NumericUpdown to ComboBox this code works just fine.
Also, if I pass a form object that

contains a NumericUpdown control into a ConfigurationClass method, I can
access the control and set its Value

property without any problem.

Can anyone tell me what I'm doing wrong? Thanks!
Apr 20 '06 #1
5 2155
Is this class in an assembly different than the one with the control in it?
I ask because if this class lives in a class library assembly, it may not
have a refrence to System.Windows.Forms, which is the namespace the
numericupdown lives in.

Check you references and and it if it is missing.
"Len Weltman" <Le********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I am trying to pass a NumericUpDown object into a class method using Visual
Studio 2005, but the control type is

not found in Intellisense and the type declaration is flagged as an error.
Here is a code sample (which doesn't

work):

*** Begin code ***

Imports System.Windows.Forms
Imports System.Net

Public Class ConfigurationClass

Private Sub LoadPortSetting ( byVal newVal as UShort, _
byVal cntrl as NumericUpdown)
cntrl.Value = newVal
End Sub

End Class

*** End code ***
Note that if I change NumericUpdown to ComboBox this code works just fine.
Also, if I pass a form object that

contains a NumericUpdown control into a ConfigurationClass method, I can
access the control and set its Value

property without any problem.

Can anyone tell me what I'm doing wrong? Thanks!

Apr 20 '06 #2
The only NumericUpDown that I could find in the MSDN library is part of the
System.Windows.Forms assembly. Any other thoughts? Thanks.

"AMDRIT" wrote:
Is this class in an assembly different than the one with the control in it?
I ask because if this class lives in a class library assembly, it may not
have a refrence to System.Windows.Forms, which is the namespace the
numericupdown lives in.

Check you references and and it if it is missing.
"Len Weltman" <Le********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I am trying to pass a NumericUpDown object into a class method using Visual
Studio 2005, but the control type is

not found in Intellisense and the type declaration is flagged as an error.
Here is a code sample (which doesn't

work):

*** Begin code ***

Imports System.Windows.Forms
Imports System.Net

Public Class ConfigurationClass

Private Sub LoadPortSetting ( byVal newVal as UShort, _
byVal cntrl as NumericUpdown)
cntrl.Value = newVal
End Sub

End Class

*** End code ***
Note that if I change NumericUpdown to ComboBox this code works just fine.
Also, if I pass a form object that

contains a NumericUpdown control into a ConfigurationClass method, I can
access the control and set its Value

property without any problem.

Can anyone tell me what I'm doing wrong? Thanks!


Apr 20 '06 #3
Got it working. I went to the My Project References tab, then to the Imported
namespaces list at bottom. System.Windows.Forms was unchecked, so I checked
it (even though it appeared in the Object Browser). NumericUpDown STILL did
not appear in Intellisense, but I typed it in anyway, and my application
built successfully. FYI, I'm building this as a service. Maybe it would've
worked OK from the start as a vanilla application. Best Regards.

"Len Weltman" wrote:
The only NumericUpDown that I could find in the MSDN library is part of the
System.Windows.Forms assembly. Any other thoughts? Thanks.

"AMDRIT" wrote:
Is this class in an assembly different than the one with the control in it?
I ask because if this class lives in a class library assembly, it may not
have a refrence to System.Windows.Forms, which is the namespace the
numericupdown lives in.

Check you references and and it if it is missing.
"Len Weltman" <Le********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I am trying to pass a NumericUpDown object into a class method using Visual
Studio 2005, but the control type is

not found in Intellisense and the type declaration is flagged as an error.
Here is a code sample (which doesn't

work):

*** Begin code ***

Imports System.Windows.Forms
Imports System.Net

Public Class ConfigurationClass

Private Sub LoadPortSetting ( byVal newVal as UShort, _
byVal cntrl as NumericUpdown)
cntrl.Value = newVal
End Sub

End Class

*** End code ***
Note that if I change NumericUpdown to ComboBox this code works just fine.
Also, if I pass a form object that

contains a NumericUpdown control into a ConfigurationClass method, I can
access the control and set its Value

property without any problem.

Can anyone tell me what I'm doing wrong? Thanks!


Apr 20 '06 #4
Len Weltman wrote:
it (even though it appeared in the Object Browser). NumericUpDown STILL did
not appear in Intellisense, but I typed it in anyway, and my application


Go to your settings for the VB editor and make sure that the "Hide
Advanced members" option is unchecked. That may be why you did not see
it in the intellisense list.

Also (if you're using VS 2005), at the bottom of the Intellisense popup
is a tab to show all or only some of the members.

Apr 20 '06 #5
That did it! Thanks.

"Chris Dunaway" wrote:
Len Weltman wrote:
it (even though it appeared in the Object Browser). NumericUpDown STILL did
not appear in Intellisense, but I typed it in anyway, and my application


Go to your settings for the VB editor and make sure that the "Hide
Advanced members" option is unchecked. That may be why you did not see
it in the intellisense list.

Also (if you're using VS 2005), at the bottom of the Intellisense popup
is a tab to show all or only some of the members.

Apr 21 '06 #6

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

Similar topics

21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
10
by: Bonj | last post by:
I'm using a number of NumericUpDown controls on my form, which controls printer settings such as number of pages. However I want to override one of the default behaviours of the control, namely...
0
by: stx | last post by:
Hope some one can help, but I need to create a resizable numericUpDown control. This I have created currently using a textbox and a user control implemented using the ControlPaint.DrawScrollButton...
2
by: bnob | last post by:
It is possible to format the numeric value of the NumericUpDown control For example : display numbers in 2 digits, instead of 1 display 01, 0 -> 00 , 9 -> 09 Any idea -- Ceci est une...
3
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
4
by: illegal.prime | last post by:
Hey all, I have a NumericUpDown control on a Panel or potentially a Form that have AutoScroll enabled. When the NumericUpDown is active I would like the Form/Panel/whatever not to scroll when I...
5
by: Guy Noir | last post by:
I have a quick question on custom controls. I have a control that I created with a class that extends the NumericUpDown control. My problem is that when I use this usercontrol on my form, the...
2
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello experts, I posted a disturbing question in here:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.