VS2005 - Passing NumericUpDown into a class method?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Len Weltman

    #1

    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 ConfigurationCl ass

    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 ConfigurationCl ass method, I can
    access the control and set its Value

    property without any problem.

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

    #2
    Re: VS2005 - Passing NumericUpDown into a class method?

    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" <LenWeltman@dis cussions.micros oft.com> wrote in message
    news:015F7795-9ACC-4DCE-B21A-2FF7432E9F16@mi crosoft.com...[color=blue]
    >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 ConfigurationCl ass
    >
    > 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 ConfigurationCl ass method, I can
    > access the control and set its Value
    >
    > property without any problem.
    >
    > Can anyone tell me what I'm doing wrong? Thanks![/color]


    Comment

    • Len Weltman

      #3
      Re: VS2005 - Passing NumericUpDown into a class method?

      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:
      [color=blue]
      > 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" <LenWeltman@dis cussions.micros oft.com> wrote in message
      > news:015F7795-9ACC-4DCE-B21A-2FF7432E9F16@mi crosoft.com...[color=green]
      > >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 ConfigurationCl ass
      > >
      > > 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 ConfigurationCl ass method, I can
      > > access the control and set its Value
      > >
      > > property without any problem.
      > >
      > > Can anyone tell me what I'm doing wrong? Thanks![/color]
      >
      >
      >[/color]

      Comment

      • Len Weltman

        #4
        Re: VS2005 - Passing NumericUpDown into a class method?

        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:
        [color=blue]
        > 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:
        >[color=green]
        > > 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" <LenWeltman@dis cussions.micros oft.com> wrote in message
        > > news:015F7795-9ACC-4DCE-B21A-2FF7432E9F16@mi crosoft.com...[color=darkred]
        > > >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 ConfigurationCl ass
        > > >
        > > > 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 ConfigurationCl ass method, I can
        > > > access the control and set its Value
        > > >
        > > > property without any problem.
        > > >
        > > > Can anyone tell me what I'm doing wrong? Thanks![/color]
        > >
        > >
        > >[/color][/color]

        Comment

        • Chris Dunaway

          #5
          Re: VS2005 - Passing NumericUpDown into a class method?

          Len Weltman wrote:[color=blue]
          > 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[/color]

          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.

          Comment

          • Len Weltman

            #6
            Re: VS2005 - Passing NumericUpDown into a class method?

            That did it! Thanks.

            "Chris Dunaway" wrote:
            [color=blue]
            > Len Weltman wrote:[color=green]
            > > 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[/color]
            >
            > 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.
            >
            >[/color]

            Comment

            Working...