Re: ComboBox - How to stop firing Select Index Event on Load

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rick (rfemmer_at_cmsstl.com)
Date: 02/16/05


Date: Wed, 16 Feb 2005 15:09:28 -0600

That works just as well, and seeing this is .net I believe I'll do it the
".Netters" way.

Thanks For the Help!

"Troy" <Troy@fmsinc.com> wrote in message
news:ehkopdGFFHA.1296@TK2MSFTNGP10.phx.gbl...
> The ".Netters" do it like this:
>
> Remove the "Handles XYZ" from the end of your SelectedIndexChanged Event.
>
> It now looks like this:
>
> Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
> ByVal e As System.EventArgs)
>
> End Sub
>
> In the load event of the form, add this line of code AFTER you do your
> binding:
> AddHandler ComboBox1.SelectedIndexChanged, AddressOf
> ComboBox1_SelectedIndexChanged
>
>
> --
> Troy
>
>
> Troy Munford
> Development Operations Manager
> FMS, Inc.
> www.fmsinc.com
>
>
> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
> news:%23EHhVSGFFHA.2452@TK2MSFTNGP09.phx.gbl...
> Not sure how the ".Netters" do it, but in VB6, you'd either create a
boolean
> called "Loading" (or whatever), set that in Form_Load to True while
loading
> and False right before the End Sub. In the event handler for the control,
> check that flag before processing. If True, just exit.
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> Please keep all discussions in the groups..
>
> "Rick" <rfemmer@cmsstl.com> wrote in message
> news:%23LywyVEFFHA.2832@TK2MSFTNGP14.phx.gbl...
> I am binding a dataset to a ComboBox(Code Below) which causes the
> SelectedIndexChanged event to fire for every record added to the combobox,
I
> would like to add code to populate a form based on the selectedvalue but I
> don't want to fire this code when binding the data to the combobox. Can
> anyone tell me how to work around this?
>
> cboMembers.DataSource = ds.Tables(0)
> cboMembers.DisplayMember = ds.Tables(0).Columns(0).ToString()
> cboMembers.ValueMember = ds.Tables(0).Columns(1).ToString()
>
> Thanks in Advance,
> Rick
>
>
>



Relevant Pages

  • Re: Binding.Format event with ComboBox
    ... I did find that the SelectedValue Binding does fire ... but it does not fire when an item is selected. ... > Private Sub Form1_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Problem with sub..._Change
    ... debugging and looking for the places that fire the change event and see ... it to update the ComboBox. ... Private Sub ComboBoxgroupW_Change ... apparently it updates as the main function iterates, ...
    (microsoft.public.excel.programming)
  • Re: Combobox linked to Custom Views
    ... the workbook opens. ... When/how do you populate the combobox? ... "Dave Peterson" wrote: ... Private Sub Workbook_Open ...
    (microsoft.public.excel.programming)
  • Re: Afterupdate event
    ... I managed to solve my problem by using the beforeupdate event and modifying ... Private Sub Form_BeforeUpdate ... place your code in the AfterUpdate event of an appropriate text control. ... So I shifted it to the afterupdate event but as I say doesn't fire. ...
    (microsoft.public.access.formscoding)
  • Re: RE: User Forms
    ... I have the FillCboBoxList sub in the userform module. ... ComboBox named: ComboBox1 ... click on, say, letter A, I want the control to populate my cbo box with ... Right-Click on the Excel icon ...
    (microsoft.public.excel.newusers)