Question

I'm on visual studio and I have trouble doing some boolean on Visual Basic for a Combo Box Boolean. I am using Visual Studio btw. I tried to add the following:

if ClientBox.ValueMember() = "Agentleader1 (Leader)" Then

But it wouldn't work.

My program is a basic Contact-Us form for a person to fill out. A field (the combo-box field, called: clientbox) is a combo-box to where you can select which member of the whole group you want to send the contact-form to. Which is a problem. I'm very sorry I can't give a sample of the code. And btw, I just started C++ please don't give complex answers and maybe add a few annotations so I can understand. Please comment this question if I have not explained enough about my program! BTW, please no C# answers.

Was it helpful?

Solution

I found a solution to my problem, if anybody is wondering here it is, sorry for my amateur-ness! This actually kinda is a better answer than anything I could have come up with (except the fact that I found this answer by myself:

if ComboBox.SelectedItem().Equals("any choice of one of the items") = True Then
    'execute command!

The above was the syntax, I got an example of my code below:

if ClientBox.SelectedItem().Equals("Agentleader1 (Leader)") = True Then
TEA = "****" 'That's my email!

Hope this helped to anybody that couldn't figure out how to find whether a specified item that is selected in a certain combo-box is selected!

OTHER TIPS

is that exactly how it is written in your code? the single '=' is an assignment operator... you need '=='

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top