I have code in a form load (and I tried it in New() too) that says:

"Removehandler me.comboCity.SelectedIndexChanged,
me.comboCity_selectedIndexChanged"

I needed to disable processing of the combo being changed while the control
binds to the arraylist data via standard data binding during form load.

Then after the data loads and the form is done I code:

"AddHandler me.comboCity.SelectedIndexChanged, AddressOf
me.comboCity_selectedIndexChanged"

But the event still fires while the databinding is taking place, why? The
event was supposed to be disabled?

Thanks,

Jeff

Re: addhandler and removehandler - work as advertised? by Rajeev

Rajeev
Mon Aug 04 00:43:13 CDT 2003

This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C35A79.654DB540
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi
well i dont know how it is done in VB.NET syntax..... in C# i am doing =
this way...

created the handler object......... EventHandler ehDBCombo =3D new =
EventHandler(XYZMethod());

and whenever required...
DBCombo.SelectedIndexChanged -=3D ehDBCombo;
.
.
. WRITE UR CODE HERE
.
.
DBCombo.SelectedIndexChanged +=3D ehDBCombo;

rajeev

"jeff" <joedirt@datahook.com> wrote in message =
news:eo1JiKRWDHA.2568@tk2msftngp13.phx.gbl...
> I have code in a form load (and I tried it in New() too) that says:
>=20
> "Removehandler me.comboCity.SelectedIndexChanged,
> me.comboCity_selectedIndexChanged"
>=20
> I needed to disable processing of the combo being changed while the =
control
> binds to the arraylist data via standard data binding during form =
load.
>=20
> Then after the data loads and the form is done I code:
>=20
> "AddHandler me.comboCity.SelectedIndexChanged, AddressOf
> me.comboCity_selectedIndexChanged"
>=20
> But the event still fires while the databinding is taking place, why? =
The
> event was supposed to be disabled?
>=20
> Thanks,
>=20
> Jeff
>=20
>
------=_NextPart_000_0015_01C35A79.654DB540
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2>hi</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>well i dont know how it is done in =
VB.NET=20
syntax.....&nbsp; in C# i am doing this way...</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>created the handler object......... =
EventHandler=20
ehDBCombo =3D new EventHandler(XYZMethod());</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>and whenever required...</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>
<DIV><FONT face=3DVerdana size=3D2>DBCombo.SelectedIndexChanged -=3D=20
ehDBCombo;</FONT></DIV>
<DIV>.</DIV>
<DIV>.</DIV>
<DIV>.&nbsp;&nbsp; WRITE UR CODE HERE</DIV>
<DIV>.</DIV>
<DIV>.</DIV>
<DIV></FONT><FONT face=3DVerdana size=3D2>DBCombo.SelectedIndexChanged =
+=3D=20
ehDBCombo;</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>rajeev</FONT></DIV></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>"jeff" &lt;</FONT><A=20
href=3D"mailto:joedirt@datahook.com"><FONT face=3DVerdana=20
size=3D2>joedirt@datahook.com</FONT></A><FONT face=3DVerdana =
size=3D2>&gt; wrote in=20
message </FONT><A =
href=3D"news:eo1JiKRWDHA.2568@tk2msftngp13.phx.gbl"><FONT=20
face=3DVerdana =
size=3D2>news:eo1JiKRWDHA.2568@tk2msftngp13.phx.gbl</FONT></A><FONT=20
face=3DVerdana size=3D2>...</FONT></DIV><FONT face=3DVerdana =
size=3D2>&gt; I have code=20
in a form load (and I tried it in New() too) that says:<BR>&gt; <BR>&gt; =

"Removehandler me.comboCity.SelectedIndexChanged,<BR>&gt;=20
me.comboCity_selectedIndexChanged"<BR>&gt; <BR>&gt; I needed to disable=20
processing of the combo being changed while the control<BR>&gt; binds to =
the=20
arraylist data via standard data binding during form load.<BR>&gt; =
<BR>&gt; Then=20
after the data loads and the form is done I code:<BR>&gt; <BR>&gt; =
"AddHandler=20
me.comboCity.SelectedIndexChanged, AddressOf<BR>&gt;=20
me.comboCity_selectedIndexChanged"<BR>&gt; <BR>&gt; But the event still =
fires=20
while the databinding is taking place, why? The<BR>&gt; event was =
supposed to be=20
disabled?<BR>&gt; <BR>&gt; Thanks,<BR>&gt; <BR>&gt; Jeff<BR>&gt; =
<BR>&gt;=20
</FONT></BODY></HTML>

------=_NextPart_000_0015_01C35A79.654DB540--


Re: addhandler and removehandler - work as advertised? by Jonny

Jonny
Mon Aug 04 03:30:44 CDT 2003

hi, jeff,
try to rewrite the statment in
RemoveHandler me.comboCity.SelectIndexChanged, addressof
me.combocity_selectedindexchanged
for more information ,you may read the following topic in msdn

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbls7/html/vblrfVBSpec7_3.htm

best regards,

Jonny

"jeff" <joedirt@datahook.com> wrote in message
news:eo1JiKRWDHA.2568@tk2msftngp13.phx.gbl...
> I have code in a form load (and I tried it in New() too) that says:
>
> "Removehandler me.comboCity.SelectedIndexChanged,
> me.comboCity_selectedIndexChanged"
>
> I needed to disable processing of the combo being changed while the
control
> binds to the arraylist data via standard data binding during form load.
>
> Then after the data loads and the form is done I code:
>
> "AddHandler me.comboCity.SelectedIndexChanged, AddressOf
> me.comboCity_selectedIndexChanged"
>
> But the event still fires while the databinding is taking place, why? The
> event was supposed to be disabled?
>
> Thanks,
>
> Jeff
>
>



Re: addhandler and removehandler - work as advertised? by Claes

Claes
Mon Aug 04 03:38:35 CDT 2003

The RemoveHandler call is missing an AddressOf
(compare it to your AddHandler call)

Turn on both Option Explicit and Option Strict and
you should get a compiler error

/claes

"jeff" <joedirt@datahook.com> wrote in message
news:eo1JiKRWDHA.2568@tk2msftngp13.phx.gbl...
> I have code in a form load (and I tried it in New() too) that says:
>
> "Removehandler me.comboCity.SelectedIndexChanged,
> me.comboCity_selectedIndexChanged"
>
> I needed to disable processing of the combo being changed while the
control
> binds to the arraylist data via standard data binding during form load.
>
> Then after the data loads and the form is done I code:
>
> "AddHandler me.comboCity.SelectedIndexChanged, AddressOf
> me.comboCity_selectedIndexChanged"
>
> But the event still fires while the databinding is taking place, why? The
> event was supposed to be disabled?
>
> Thanks,
>
> Jeff
>
>



Re: addhandler and removehandler - work as advertised? by Chris

Chris
Tue Aug 12 14:31:43 CDT 2003

>
>

Just out of curiosity, does your comboCity_selectedIndexChanged method have
a Handles clause at the end? If so, you probably need to remove this as it
may be adding an additional handler to your event.

Just a thought.

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail