By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,540 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

Event that caused checkbox to fill?

P: n/a
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.
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <vo******@yahoo.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
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.

Nov 15 '05 #2

P: n/a
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.machin AT dot.state.fl.us> wrote
in message news:e4*************@TK2MSFTNGP11.phx.gbl...
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" <vo******@yahoo.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
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.


Nov 15 '05 #3

P: n/a
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" <vo******@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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.machin AT dot.state.fl.us> wrote in message news:e4*************@TK2MSFTNGP11.phx.gbl...
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" <vo******@yahoo.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
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.



Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.