Jump to content
Sign in to follow this  
Star.

Visual Basic Help

Recommended Posts

-snip-


rc1tzc.png

☢ CAUTION ☢ CAUTION ☢ CAUTION ☢ CAUTION ☢

Share this post


Link to post
Share on other sites

I'm honestly not sure what you're asking. Are you having a logic problem? Because your code looks syntactically correct...


polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Share this post


Link to post
Share on other sites

Did I write too much? I didn't want to leave anything out in case someone didn't understand but I guess that backfired :P

 

I want to display the CardCharge in the lblCreditTotal but it's not displaying despite me putting 'lblCreditTotal.Text = CardCharge' after the IF statements.


rc1tzc.png

☢ CAUTION ☢ CAUTION ☢ CAUTION ☢ CAUTION ☢

Share this post


Link to post
Share on other sites

Your If statement isn't working correctly. If the first checkbox is ticked then it's not going to be doing the others which is why it's filling the first two correctly then ignoring the rest as they're in others.

 

There are numerous ways to fix it depending on exactly what you want and how the program works (Like what being a member means etc.) so I can't help much with that. But the problem is that your if statement is faulty.

Share this post


Link to post
Share on other sites

Ahh ok, I get it.

 

Yeah, you should write separate if statements instead of if and elseif.

 

To elaborate: Your statement where you change the label text will work, but that variable won't have a value since if you have the member checkbox checked the variable won't be set.


polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Share this post


Link to post
Share on other sites

Try replacing "ElseIf" with "If" in the subroutine "btnTotal_Click"


"The more persistence a game tries to have; the longer it is set up to last; the greater number (and broader variety) of people it tries to attract; and in general the more immersive a game/world it set out to be--then the more breadth and depth of human experience it needs to support to be successful for more than say, 12-24 months. If you try to create a deeply immersive, broadly appealing, long-lasting world that does not adequately provide for human tendencies such as violence, acquisition, justice, family, community, exploration, etc (and I would contend we are nowhere close to doing this), you will see two results: first, individuals in the population will begin to display a wide range of fairly predictable socially pathological behaviors (including general malaise, complaining, excessive bullying and/or PKing, harassment, territoriality, inappropriate aggression, and open rebellion against those who run the game); and second, people will eventually vote with their feet--but only after having passionately cast 'a pox on both your houses.' In essence, if you set people up for an experience they deeply crave (and mostly cannot find in real life) and then don't deliver, they will become like spurned lovers--somebecome sullen and aggressive or neurotic, and eventually almost all leave."

Mike Sellers' Hypothesis

Share this post


Link to post
Share on other sites

Something so simple... Righto, thanks guys, I was having trouble with that all night.

 

Now I got to write If statements for when the checkbox is unchecked.

 

 

 

I thought the ElseIf had to applied because the first statement was true :s


rc1tzc.png

☢ CAUTION ☢ CAUTION ☢ CAUTION ☢ CAUTION ☢

Share this post


Link to post
Share on other sites

I thought the ElseIf had to applied because the first statement was true :s

 

ElseIf only comes into it if the previous conditions of the If Statement have not been met and are just additional conditions added. So if the first condition of the if statement isn't met it'll go to the elseif and see if that condition is met, if not it'll go down further to the next elseif and see if that's met. Once one condition is met and the contents of the condition have been performed it'll exit from the If Statement.

 

If you want multiple If statements within an If statement then nesting them is the way to go about that so that'd be

 

If X = True then

    DO STUFF HERE
    If Y = True then
         DO THIS STUFF
   else
        DO THIS STUFF INSTEAD
   End If

else
    DO THIS
End If

 

What that'll do is if X = True it'll then go down to the next If statement within the first If statement. Hope that makes sense.

Share this post


Link to post
Share on other sites

Yes, that makes perfect sense, thank you ^_^ You gave the explanation better than my tutor did for sure.

 

I have sorted that part of the code and it works great :D


rc1tzc.png

☢ CAUTION ☢ CAUTION ☢ CAUTION ☢ CAUTION ☢

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.