470,636 Members | 1,582 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

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 2015
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tantra Veda | last post: by
10 posts views Thread by Bonj | last post: by
reply views Thread by stx | last post: by
2 posts views Thread by bnob | last post: by
2 posts views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.