Event Handler on INT variable watching for value?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Styk

    Event Handler on INT variable watching for value?

    Hi,

    Is there a way to create an event handler on variable and watch for a
    specified value to occour?

    Let's say i want a method executed when value of x = 10 and x=15

    Thanks


  • Marina

    #2
    Re: Event Handler on INT variable watching for value?

    No, the handler will always fire. But inside, you can look at the value and
    just do nothing if the value is not acceptable.

    "Peter Styk" <ilman@dobrebop olskie.NoNoNo.c om> wrote in message
    news:ezIigEsYFH A.3032@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi,
    >
    > Is there a way to create an event handler on variable and watch for a
    > specified value to occour?
    >
    > Let's say i want a method executed when value of x = 10 and x=15
    >
    > Thanks
    >
    >[/color]


    Comment

    • Peter Styk

      #3
      Re: Event Handler on INT variable watching for value?

      Ok, but how exactly would you do that in C#?




      "Marina" <someone@nospam .com> wrote in message
      news:e86ycUsYFH A.2996@TK2MSFTN GP10.phx.gbl...[color=blue]
      > No, the handler will always fire. But inside, you can look at the value
      > and just do nothing if the value is not acceptable.
      >
      > "Peter Styk" <ilman@dobrebop olskie.NoNoNo.c om> wrote in message
      > news:ezIigEsYFH A.3032@TK2MSFTN GP10.phx.gbl...[color=green]
      >> Hi,
      >>
      >> Is there a way to create an event handler on variable and watch for a
      >> specified value to occour?
      >>
      >> Let's say i want a method executed when value of x = 10 and x=15
      >>
      >> Thanks
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Marina

        #4
        Re: Event Handler on INT variable watching for value?

        You would use an if statement to see if the value of the variable matches
        your criteria, and only then do something.

        If you are looking for anything more specific, it's impossible to say. Your
        question was quite vague.

        "Peter Styk" <ilman@dobrebop olskie.NoNoNo.c om> wrote in message
        news:emsrO9sYFH A.1868@TK2MSFTN GP14.phx.gbl...[color=blue]
        > Ok, but how exactly would you do that in C#?
        >
        >
        >
        >
        > "Marina" <someone@nospam .com> wrote in message
        > news:e86ycUsYFH A.2996@TK2MSFTN GP10.phx.gbl...[color=green]
        >> No, the handler will always fire. But inside, you can look at the value
        >> and just do nothing if the value is not acceptable.
        >>
        >> "Peter Styk" <ilman@dobrebop olskie.NoNoNo.c om> wrote in message
        >> news:ezIigEsYFH A.3032@TK2MSFTN GP10.phx.gbl...[color=darkred]
        >>> Hi,
        >>>
        >>> Is there a way to create an event handler on variable and watch for a
        >>> specified value to occour?
        >>>
        >>> Let's say i want a method executed when value of x = 10 and x=15
        >>>
        >>> Thanks
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Jon Skeet [C# MVP]

          #5
          Re: Event Handler on INT variable watching for value?

          Peter Styk <ilman@dobrebop olskie.NoNoNo.c om> wrote:[color=blue]
          > Is there a way to create an event handler on variable and watch for a
          > specified value to occour?
          >
          > Let's say i want a method executed when value of x = 10 and x=15[/color]

          That sounds like a good case for using a property.

          --
          Jon Skeet - <skeet@pobox.co m>
          Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

          If replying to the group, please do not mail me too

          Comment

          Working...