Event that caused checkbox to fill?

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

    Event that caused checkbox to fill?

    I have a textbox in my Win form that can be filled when a user chooses an
    emplcode from a combobox and when the value is returned from another form
    (double-clicks on a separate listbox).
    What event can I use to find out how the textbox got filled? In my case, if
    the textbox is filled when the user double-clicked on a separate listbox,
    I'd like to run VerifyEmp() method. If it's via the combobox or by hand, I
    don't do anything.
    Someone suggested validating/validation events but I have no idea how to use
    them.

    Thanks.


  • Ignacio Machin \( .NET/ C#  MVP \)

    #2
    Re: Event that caused checkbox to fill?

    Hi,

    I don;t think that you can do this from the TextBox's point, all you can
    see is that the text was changed (TextChanged event), no where the
    TextBox.Text was set.

    Now I can think of a possible solution:

    Make the check in the handlers of the other controls when needed, in the
    double click event of the listbox for example.


    Cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation

    "Vaughn" <vonchi_m@yahoo .com> wrote in message
    news:O6dJO3KlDH A.1084@tk2msftn gp13.phx.gbl...[color=blue]
    > I have a textbox in my Win form that can be filled when a user chooses an
    > emplcode from a combobox and when the value is returned from another form
    > (double-clicks on a separate listbox).
    > What event can I use to find out how the textbox got filled? In my case,[/color]
    if[color=blue]
    > the textbox is filled when the user double-clicked on a separate listbox,
    > I'd like to run VerifyEmp() method. If it's via the combobox or by hand, I
    > don't do anything.
    > Someone suggested validating/validation events but I have no idea how to[/color]
    use[color=blue]
    > them.
    >
    > Thanks.
    >
    >[/color]


    Comment

    • Vaughn

      #3
      Re: Event that caused checkbox to fill?

      Thanks for your reply.
      I didn't really understand what you meant with making the check in the
      handlers of the other controls.
      If I pass the whole form as reference, do I have access to all of its
      controls? Or do I need to pass all the controls as reference?

      Vaughn

      PD - In the subject line, it's supposed to be "textbox", not "checkbox".


      "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
      in message news:e4IJ2cLlDH A.392@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Hi,
      >
      > I don;t think that you can do this from the TextBox's point, all you can
      > see is that the text was changed (TextChanged event), no where the
      > TextBox.Text was set.
      >
      > Now I can think of a possible solution:
      >
      > Make the check in the handlers of the other controls when needed, in the
      > double click event of the listbox for example.
      >
      >
      > Cheers,
      >
      > --
      > Ignacio Machin,
      > ignacio.machin AT dot.state.fl.us
      > Florida Department Of Transportation
      >
      > "Vaughn" <vonchi_m@yahoo .com> wrote in message
      > news:O6dJO3KlDH A.1084@tk2msftn gp13.phx.gbl...[color=green]
      > > I have a textbox in my Win form that can be filled when a user chooses[/color][/color]
      an[color=blue][color=green]
      > > emplcode from a combobox and when the value is returned from another[/color][/color]
      form[color=blue][color=green]
      > > (double-clicks on a separate listbox).
      > > What event can I use to find out how the textbox got filled? In my case,[/color]
      > if[color=green]
      > > the textbox is filled when the user double-clicked on a separate[/color][/color]
      listbox,[color=blue][color=green]
      > > I'd like to run VerifyEmp() method. If it's via the combobox or by hand,[/color][/color]
      I[color=blue][color=green]
      > > don't do anything.
      > > Someone suggested validating/validation events but I have no idea how to[/color]
      > use[color=green]
      > > them.
      > >
      > > Thanks.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Ignacio Machin \( .NET/ C#  MVP \)

        #4
        Re: Event that caused checkbox to fill?

        Hi Vaughn,

        What I meant is that you inside the handler for the TextBox's TextChanged
        event you cannot know what method provoked the event.
        If you need to verify the value you have two path:
        1- Always verify it, unless that your validation code is slow you should
        always check it.
        2- Put the checking responsability to the event that needs validation ont he
        DoubleClick event of the ListBox.

        Now you said this listbox was on another form , therefore for you to have
        access to the original form's TextBox you could pass either the TextBox
        instance of a reference to the whole form, if you do the latter you need to
        define either the TextBox as public or implement a property that return it.

        I would pass only the TextBox reference.


        Hope this help,

        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation

        "Vaughn" <vonchi_m@yahoo .com> wrote in message
        news:%23MlTJySl DHA.964@TK2MSFT NGP10.phx.gbl.. .[color=blue]
        > Thanks for your reply.
        > I didn't really understand what you meant with making the check in the
        > handlers of the other controls.
        > If I pass the whole form as reference, do I have access to all of its
        > controls? Or do I need to pass all the controls as reference?
        >
        > Vaughn
        >
        > PD - In the subject line, it's supposed to be "textbox", not "checkbox".
        >
        >
        > "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >[/color]
        wrote[color=blue]
        > in message news:e4IJ2cLlDH A.392@TK2MSFTNG P11.phx.gbl...[color=green]
        > > Hi,
        > >
        > > I don;t think that you can do this from the TextBox's point, all you[/color][/color]
        can[color=blue][color=green]
        > > see is that the text was changed (TextChanged event), no where the
        > > TextBox.Text was set.
        > >
        > > Now I can think of a possible solution:
        > >
        > > Make the check in the handlers of the other controls when needed, in[/color][/color]
        the[color=blue][color=green]
        > > double click event of the listbox for example.
        > >
        > >
        > > Cheers,
        > >
        > > --
        > > Ignacio Machin,
        > > ignacio.machin AT dot.state.fl.us
        > > Florida Department Of Transportation
        > >
        > > "Vaughn" <vonchi_m@yahoo .com> wrote in message
        > > news:O6dJO3KlDH A.1084@tk2msftn gp13.phx.gbl...[color=darkred]
        > > > I have a textbox in my Win form that can be filled when a user chooses[/color][/color]
        > an[color=green][color=darkred]
        > > > emplcode from a combobox and when the value is returned from another[/color][/color]
        > form[color=green][color=darkred]
        > > > (double-clicks on a separate listbox).
        > > > What event can I use to find out how the textbox got filled? In my[/color][/color][/color]
        case,[color=blue][color=green]
        > > if[color=darkred]
        > > > the textbox is filled when the user double-clicked on a separate[/color][/color]
        > listbox,[color=green][color=darkred]
        > > > I'd like to run VerifyEmp() method. If it's via the combobox or by[/color][/color][/color]
        hand,[color=blue]
        > I[color=green][color=darkred]
        > > > don't do anything.
        > > > Someone suggested validating/validation events but I have no idea how[/color][/color][/color]
        to[color=blue][color=green]
        > > use[color=darkred]
        > > > them.
        > > >
        > > > Thanks.
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...