简体   繁体   中英

VB.NET ComboBox Not Recognising Text Change

I have an application whereby I have the behaviour of 2 groupboxes enable/disable based on the value in a combobox.

This combobox however the behaviour for the group boxes only works when I leave the field by tab or click, not when the text changes.

I have tried using the Leave, TextChanged, Validated Events and everytime I have to actually "Leave" the field for it to perform the enabled/disabled of the groupboxes and their subsequent controls.

I need it so that when they choose 1 of the 3 options it immediately changes and doesn't work when they leave the field but when they choose the correct word.

Any assistance would be great I'm tearing my hair out here.

I think you are looking for the event on your combo boxes

SelectedIndexChanged

To stop the user from leaving an invalid field use the event

Validating

set the e.cancel to True if the validation fails

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM