473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Conditions evaluation

This is really dumb, but it's giving me problems.
Can't get this ElseIf to get to the next image control to make it visible.
Dim strRedSox As String
Dim strYankee As String
Dim strFull As String

strRedSox = lstRedSox.Text
strYankee = lstYankee.Text
strFull = strRedSox$ & strYankee$

If strFull$ = PedroJeter Then
imgPedro.Visible = True
MsgBox "________", vbInformation, "___________!"
ElseIf strFull$ = SchillingJeter Then
' imgPedro.Visible = False
imgSchilling.Visible = True

Tried w/o the comment and about six other ways, imgPedro always displays.
Would a Select Case statement be better, and if so how?
Thanx.
Jul 17 '05 #1
4 2177
Steve Z wrote:
This is really dumb, but it's giving me problems.
Can't get this ElseIf to get to the next image control to make it visible.
Dim strRedSox As String
Dim strYankee As String
Dim strFull As String

strRedSox = lstRedSox.Text
strYankee = lstYankee.Text
strFull = strRedSox$ & strYankee$

If strFull$ = PedroJeter Then
imgPedro.Visible = True
MsgBox "________", vbInformation, "___________!"
ElseIf strFull$ = SchillingJeter Then
' imgPedro.Visible = False
imgSchilling.Visible = True

Tried w/o the comment and about six other ways, imgPedro always displays.
Would a Select Case statement be better, and if so how?
Thanx.


Seems like you need to remove the `$' on your strs in the if/then/else
statement, since you dimmed them w/o the $ (which is preferable anyway)

Also, I think your PedroJeter and SchillingJeter should be in quotes, as
right now the program sees them as variable

Try making sure Option Explicit is on, that way the compiler picks up
undeclared variables, and thus little errors like this (and spelling
erros too)

Scott Zielinski

Jul 17 '05 #2

"Gemini" <sp**@nospam.org> wrote in message
news:75***************************@dcanet.allthene wsgroups.com...

Seems like you need to remove the `$' on your strs in the if/then/else
statement, since you dimmed them w/o the $ (which is preferable anyway)

Also, I think your PedroJeter and SchillingJeter should be in quotes, as
right now the program sees them as variable

Try making sure Option Explicit is on, that way the compiler picks up
undeclared variables, and thus little errors like this (and spelling
erros too)

SZ, much appreciated.
I had thought of Option Explicit, you're right, it does come back with
PedroJeter as an undeclared variable.
And removing the designation that the variable accepts a string($) and
quotes were also tried. When quotes were added nothing happened to the image
control/MsgBox on execution, program just sits there, no errors.
Here's the weird part - it works the way it is, the first image control and
MsgBox display, just the ElseIf fails and the same image control is
displayed. But it doesn't look like variables are moving correctly with the
= assignment, the Locals window shows no movement.
I looked a lot today and couldn't find anything, I'll try again manana.
Jul 17 '05 #3
Steve Z wrote:
SZ, much appreciated.
I had thought of Option Explicit, you're right, it does come back with
PedroJeter as an undeclared variable.
And removing the designation that the variable accepts a string($) and
quotes were also tried. When quotes were added nothing happened to the image
control/MsgBox on execution, program just sits there, no errors.
Here's the weird part - it works the way it is, the first image control and
MsgBox display, just the ElseIf fails and the same image control is
displayed. But it doesn't look like variables are moving correctly with the
= assignment, the Locals window shows no movement.
I looked a lot today and couldn't find anything, I'll try again manana.


Make sure that 1st line in the ELSEIF statement is uncommented.

Also are these in the form_load sequence?
strRedSox = lstRedSox.Text
strYankee = lstYankee.Text
strFull = strRedSox$ & strYankee$

If so, when the program is executed, you haven't selected anything for
the listboxes to return (in order for strRedSox= "Pedro" you have to
have Pedro highlighted in the listbox *before* those varibles are
initialized; which means you should set that code, and it appears maybe
all of the code you posted, in the commandbutton_click event procedure.

Scott Zielinski
Jul 17 '05 #4

"Gemini" <sp**@nospam.org> wrote in message
news:23***************************@dcanet.allthene wsgroups.com...


Make sure that 1st line in the ELSEIF statement is uncommented.

Also are these in the form_load sequence?
strRedSox = lstRedSox.Text
strYankee = lstYankee.Text
strFull = strRedSox$ & strYankee$

If so, when the program is executed, you haven't selected anything for
the listboxes to return (in order for strRedSox= "Pedro" you have to
have Pedro highlighted in the listbox *before* those varibles are
initialized; which means you should set that code, and it appears maybe
all of the code you posted, in the commandbutton_click event procedure.

My bad, this is click event procedure code.
There's some check boxes that fill the listboxes prior to the command click
event.
Still confused, I tried a couple things today, Select Case's and nesting the
If Then's, everything works just like the initial code, the first img
control displays no matter the change in condition.
Still working on it....

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John Ratliff | last post by:
Does C++ employ lazy evaluation of boolean conditions, e.g. can I do the following safely if ((obj != NULL) || (obj->someMethod())) { // blah blah } Or will I get a segfault if the obj ptr...
14
by: Kay Schluehr | last post by:
One of the main reasons Pythons anonymous function lambda is considered to be "broken" is Pythons disability to put statements into expressions and support full functionality. Many attempts to...
24
by: Kunal | last post by:
Hello, I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I...
54
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of...
39
by: Boltar | last post by:
Why does C do lazy evaluation for logical boolean operations but not bitwise ones? Ie: the following program prints "1 2" , not "1 1" under gcc main() { int a = 1; int b = 1; 0 && ++a;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.