3 Replies - 444 Views - Last Post: 21 January 2013 - 06:25 PM Rate Topic: -----

#1 carpentierpj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-January 13

Combo Box Events

Posted 21 January 2013 - 03:37 PM

Hello, and thanks in advance.

I'm obviously new to VB 2005, and I'm making a data entry window that collects 269 data points (0, 1 or 2) in combo boxes. I want to do validation on a keystroke to the combo box but cannot discover how. If it is valid (0, 1, or 2) I want it to jump the the next combo box, if it is invalid, I want a beep, and the box to clear to the default of zero. I'd also like to know how to handle a backspace event so I can highlight the previous combo box.

Thanks so much

I've tested SelectedIndexChanged and it's not the right solution.

Is This A Good Question/Topic? 0
  • +

Replies To: Combo Box Events

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9583
  • View blog
  • Posts: 36,319
  • Joined: 12-June 08

Re: Combo Box Events

Posted 21 January 2013 - 03:46 PM

Why not turn the 'drop down style' from 'drop down' to 'drop down list'? Then the values are constrained to what you set up at the start... no worry about validating!
Was This Post Helpful? 0
  • +
  • -

#3 carpentierpj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-January 13

Re: Combo Box Events

Posted 21 January 2013 - 06:03 PM

Thanks, I'll look at that. But how come I can't find a way to trigger an event when the text in the combobox changes?

Thanks again
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9583
  • View blog
  • Posts: 36,319
  • Joined: 12-June 08

Re: Combo Box Events

Posted 21 January 2013 - 06:25 PM

It's all about the firing of the events.. for kicks you should slap a few on the control and have it print out to the debug window.. see what fires when.

If you are typing that doesn't change an index until, typically, the user leaves the control or selects something from the drop down.. if you were looking for a 'text change' then use that event.

OnTextChanged
http://msdn.microsof...s.combobox.aspx

but.. all that aside what you told me sounds like you need to lock down the control's input and just use the predefined values you give it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1