Home > database >  Compare Combobox value VB.NET
Compare Combobox value VB.NET

Time:09-13

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.

CodePudding user response:

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.

  • Related