[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Combo Box Event Firing at Load

I have an application such that it has a combo box and when the form is up and loaded; I'd like to call another form when they select an item in the combo box.

I've tried putting the following code in various events (its currently in selectedvaluechange) but no matter where I put it; vb.net opens the form when it first loads without anyone even having an opportunity to see the combo box on the screen much less click on it.

Should I be using a diff event or different code.

Under selectedvaluechange I have

  If cboDiscounts.Text Like "*system.data.datarowview*" Or System.Convert.IsDBNull(cboDiscounts.Text) = True Then

        Else

            discountentry.ShowDialog()
        End If

Basically; by using if system.data.datarowview which I'm not even sure you can use in an expression or isdbnull; I'm trying to tell it that while the form is still loading and the text in the comboxbox is blank; do nothing. Wait for the combo to load and let the user click something then open the form.

No success. yet.
Thanks for anyones help with this !
0
sny23vpb
Asked:
sny23vpb
  • 3
  • 2
  • 2
2 Solutions
 
SanclerCommented:
Best bet is to declare a form level boolean variable

   Private Loading As Boolean = True

Put

   If Loading Then Exit Sub

in your combobox' event procedure/s

and not set

   Loading = False

until the end of your form_load sub

Roger
0
 
sny23vpbAuthor Commented:
what event would you put the loading=false in ?  I tried at the end of initializecomponent I tried at the end of finalize ; but no luck.

Thanks again.
0
 
SanclerCommented:
Form_Load or Form_Activated, assuming that your combobox is fully loaded with values, or bound to a datasource that is fully loaded with values, at that point.

Roger
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
t_itaniumCommented:
are using windows application or web application??
0
 
sny23vpbAuthor Commented:
windows application in visual studio 2003.  Perhaps I'm not looking in the right place. I only see the events for   new, finalize, and initialize component.  I don't see a form load event. Thanks for your help.
0
 
t_itaniumCommented:
well you can double click your fomr designer and then the from load event will appear..

:)
0
 
sny23vpbAuthor Commented:
Thank you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now