[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

For MartinLiss re:Q_28413474.html you helped me with

Posted on 2014-04-16
13
Medium Priority
?
141 Views
Last Modified: 2014-04-16
Thanks for the help i am trying to expand-modify your code
we have based the code on value of gcurCleoNewGameCredits instead of the value in lblcredit
but actually lblcredit could be any value even negative
Example:
Opening a saved file fills the value of lblcredit(could also be negative) and be credit or currency
each time the program is ran the amount of the bet is subtracted from lblCredit.
this is where i am having a problem
Clicking cmdbetmode that changes the denomation should update lblCredit.
Easy if lblCredit is in currency(no change needed)
if lblcredit is in credit mode is where i am having difficulty.
how can this be written ?
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40004499
I added a command button called cmdPlay and added this code.

Private Sub cmdPlay_Click()

    Select Case mintBetMode
        Case 0
            gcurCleoNewGameCredits = gcurCleoNewGameCredits - 0.01
        Case 1
            gcurCleoNewGameCredits = gcurCleoNewGameCredits - 0.02
        Case 2
            gcurCleoNewGameCredits = gcurCleoNewGameCredits - 0.05
        Case 3
            gcurCleoNewGameCredits = gcurCleoNewGameCredits - 0.1
        Case Else
            gcurCleoNewGameCredits = gcurCleoNewGameCredits - 0.25
    End Select
    lblCredit.Caption = Format(gcurCleoNewGameCredits, "currency")
End Sub

Open in new window


Is that what you want?
0
 

Author Comment

by:isnoend2001
ID: 40004555
No cannot use gcurCleoNewGameCredits

I tried this to no avail
Private Sub cmdbetmode_Click()
    Dim value As Currency
    Dim lblCreditValue As String
    lblCreditValue = lblCredit' get the value of lblCredit
    ChangeBetMode
   
 If mintCreditMode = 0 Then 'credit
    value = Val(lblCredit)
    lblCredit = DetermineCredits
 Else
    value = CCur(lblCredit)
    lblCredit = DetermineCurrency(value, mintBetMode)
    lblCredit = Format(lblCredit, "currency")
 End If
End Sub
I will elaborate:
0
 

Author Comment

by:isnoend2001
ID: 40004574
User starts a new game and lblCredit = gcurCleoNewGameCredits = $1.00
user makes a bet  and makes a few runs and each run the amount is subtracted from lblCredit.
lblcredit now reads in 1 cent mode 90 or $.90 in currency.
now click lblcredit
Now click cmdbetmode to change the denomination to 2 cents
lblcredit should read 45 & $.90 in currency
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 49

Expert Comment

by:Martin Liss
ID: 40004606
That seems to be exactly what the attached project does.

Start the app - lblCredit reads $1.00
Click "Play" 10 times - lblcredit now reads $0.90
Click lblCredit - lblCredit now reads 90
Click cmdBetMode which changes it to 2 cents - lblCredit reads 45 and $0.90
Marty.zip
0
 

Author Comment

by:isnoend2001
ID: 40004613
The variable gcurCleoNewGameCredits can only  be used for a new game all other times.
the value of lblcredit needs to be used.
See attached:
gcurCleoNewGameCredits.jpg
0
 

Author Comment

by:isnoend2001
ID: 40004664
Almost
this is how it should work:
in 1 cent mode
lblcredit reads $1.00 and 100 in credit mode
in credit mode click cmdbetmode should display in lblcredit 50 (2 cent mode)
Click cmdbetmode again lblCredit should display 20 (5 cent mode)
Click cmdbetmode again lblCredit should display 10 (10 cent mode)
Click cmdbetmode again lblCredit should display 4 (25 cent mode)
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40004682
Why? (this is a response to post ID 40004664)

In the test app we have this.

Private Sub Form_Load()
'new
'gcurCleoNewGameCredits = "$1.00"
gcurCleoNewGameCredits = 1

lblCredit = Format(gcurCleoNewGameCredits, "currency")
End Sub

Open in new window


What can't line 4 be changed to get last game's value from the ini or text file you are using to save the values?
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40004724
Add the new line shown here.

Private Sub cmdbetmode_Click()
ChangeBetMode
'new
lblCredit.Caption = DetermineCredits
End Sub

Open in new window

0
 

Author Comment

by:isnoend2001
ID: 40004727
Yes that is correct
I am trying to work on the current lblcredit display by clicking the cmdbetmode button
0
 

Author Comment

by:isnoend2001
ID: 40004741
Thats almost it
Private Sub cmdbetmode_Click()
ChangeBetMode
'new
lblCredit.Caption = DetermineCredits
End Sub
  It displays  correctly in lblcredit, but switches it to credits if in currency
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40004755
Private Sub cmdbetmode_Click()
ChangeBetMode
'new
If InStr(1, lblCredit.Caption, "$") = 0 Then
    lblCredit.Caption = DetermineCredits
End If
End Sub

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 40004804
Thanks looks good
Martinliss sorry about my poor explaining.
It is quite clear you can code anything if given better explanations.
thanks a lot
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40004907
You're welcome and I'm glad I was able to help. And thank you for the compliment. I'm an old man that's been doing this for a long time and it's nice to know that I can still help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question