Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 09:46 PM
Steve Z
Guest
 
Posts: n/a
Default 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.


  #2  
Old July 17th, 2005, 09:46 PM
Gemini
Guest
 
Posts: n/a
Default Re: Conditions evaluation

Steve Z wrote:
[color=blue]
> 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.
>[/color]

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

  #3  
Old July 17th, 2005, 09:46 PM
Steve Z
Guest
 
Posts: n/a
Default Re: Conditions evaluation


"Gemini" <spam@nospam.org> wrote in message
news:753c9$4056154a$d89e2d68$15586@dcanet.allthene wsgroups.com...[color=blue][color=green]
>>[/color]
> 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)
>[/color]
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.


  #4  
Old July 17th, 2005, 09:46 PM
Gemini
Guest
 
Posts: n/a
Default Re: Conditions evaluation

Steve Z wrote:[color=blue]
> 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.
>[/color]

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
  #5  
Old July 17th, 2005, 09:46 PM
Steve Z
Guest
 
Posts: n/a
Default Re: Conditions evaluation


"Gemini" <spam@nospam.org> wrote in message
news:23148$40573382$d89e2d68$24156@dcanet.allthene wsgroups.com...[color=blue][color=green]
> >[/color]
>
> 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.
>[/color]
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....



 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles