简体   繁体   中英

Compare Combobox value VB.NET

I have 3 Combobox called: NB1,NB2,NB3. this Comboboxs has 2 values: " - " or another text

If the text of each of these combo boxes is equal to each other, it will give an error (msgbox) and the combo box that has " - " will not be compared. Example:

Combo1 Combo2 Combo3 Result
A B A Error
A A A Error
A - A Error
- C A OK
D B A OK
- - - OK
- F A OK
- D D Error

Thanks for helping me.

i solved this problem by AndAlso Structure. " - " will appear when the value of textbox be 0.

(cb_1.Text = cb_2.Text AndAlso Val(txt_1.Text) > 0)

works fine.

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