Avatar of al4629740
al4629740Flag for United States of America

asked on 

check for text on my dropdown box

I have a dropdown box in VB6.  The combobox has different months of the year in the dropdown list depending on what month we are in.  The items show only two months at a time through any given month so that noone can select any month they want.

What I want to do is write an IF/Then statement to run some code if the combobox has the months of June and July in it.

How do I write the IF statement in order to do it?
Visual Basic Classic

Avatar of undefined
Last Comment
al4629740
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Since you are showing 2 months at a time, then when June is showing it would be natural that July would also be showing unless your months are not in chronological order.  therefore you should just check that the value of the combo is equal to June...


IF UCase(MyCombo.Text) = "JUNE" Then

   ' do your thing here  :)

End If

Open in new window

Avatar of Ali HND
Ali HND
Flag of Iran, Islamic Republic of image

IF UCase(ComboBox1.Text) = "JUNE" and UCase(ComboBox2.Text) = "JULY"  then

' do somthing

End If
ASKER CERTIFIED SOLUTION
Avatar of HooKooDooKu
HooKooDooKu

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of al4629740
al4629740
Flag of United States of America image

ASKER

HooKoo's solution worked best.  Thanks
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo