Solved

How to write a formula getting data from a flexigrid

Posted on 2013-12-13
24
242 Views
Last Modified: 2013-12-14
Trying to determine how to write code as numbers are selected from a flexigrid.
The grid:   HITS    WIN needs to be updated as numbers are selected based on the bet amount and number of selections.
How to write this ?image of code neededSee jpg
0
Comment
Question by:isnoend2001
  • 15
  • 9
24 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39717774
Sorry but I'm not sure I understand the "hits". It looks like you've selected 6 numbers (1, 2, 11, 12, 13, 15). Since just one of those numbers is in column 6 is that mean there is just one hit? In any case please attach your project in a zip file.
0
 

Author Comment

by:isnoend2001
ID: 39717991
Sorry, didn't explain enough
The grid with all the columns hold how much a user would win if 6 spots were chosen.
Don't think that the project will help, but i will attach it. i have not done the selecting of the numbers yet.. this is a Keno game. The grid shows how much a user would win if 6 spots were selected. the game randomly selects 20 numbers of the 80 on the board
In other words If the user selected 6 spots no matter where in the 80 numbers in the grid the
pay would be
3-hits = 2 (3rd-row )in the 6 column)x bet amount (5) = 10
4-hits = 5  (4th-row )x bet amount(5) = 25
5-hits = 34 (5th-row ) x bet amount(5)= 170
6-hits = 375 (5th-row ) x bet amount(5)= 1875
if the user had selected 7 numbers then the winnings would be taken from the 7th column
0
 

Author Comment

by:isnoend2001
ID: 39718002
attached file (pretty big) 9.29 mb lots of graphics.
EE gave this message:The extension of one or more files in the archive is not in the list of allowed extensions: Keno 12_13_13/Group1.vbg
Don't know how i got that vbg file i will try to get rid of it
0
 

Author Comment

by:isnoend2001
ID: 39718024
attached try again
now i get this message
The extension of one or more files in the archive is not in the list of allowed extensions: Keno 12_13_13/MSSCCPRJ.SCC Don't even know what a .SCC file is
0
 

Author Comment

by:isnoend2001
ID: 39718043
deleted the .SCC file trying again
0
 

Author Comment

by:isnoend2001
ID: 39718047
still not success trying again
Keno-12-13-13.zip
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39718122
OK I have the project running. What specifically would you like help with?
0
 

Author Comment

by:isnoend2001
ID: 39718143
Thanks
As i have stated earlier i am working on the part of selecting numbers.
I need help putting the values in the left grid(flexStatus)based on the number of selections
and the bet amount eg:
eg;
3 numbers marked
4 numbers marked
5 numbers marked
all the way to 10
0
 

Author Comment

by:isnoend2001
ID: 39718161
I have added this sub
It might help to clarify
Private Sub flexCleo_Click()
    Static MAX_SELECTIONS As Integer
    If MAX_SELECTIONS >= 10 Then Exit Sub
    If MAX_SELECTIONS = 3 Then 'less than 3 pays nothing
    'start updating flexstatus with each selection
    End If
    Dim r As Integer
    Dim c As Integer
    r = flexCleo.Row
    c = flexCleo.Col
    flexCleo.Row = r
    flexCleo.Col = c
    flexCleo.CellForeColor = vbYellow
    Set flexCleo.CellPicture = imgSelNotHit.Picture
    MAX_SELECTIONS = MAX_SELECTIONS + 1
End Sub

Open in new window

0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39718201
Sorry that I'm still not getting it. In Command7_Click you have the following code:

With flexStatus
.TextMatrix(1, 0) = 3
.TextMatrix(1, 1) = 10 ' 2 x mBetcredits(5)= 10
.TextMatrix(2, 0) = 4
.TextMatrix(2, 1) = 25 '5 x mBetcredits(5)= 25
.TextMatrix(3, 0) = 5
.TextMatrix(3, 1) = 170 '34 xmBetcredits(5)= 170
.TextMatrix(4, 0) = 6
.TextMatrix(4, 1) = 1875 '375 x mBetcredits(5)= 1875
End With

Open in new window


Why is .TextMatrix(1, 0) = 3?
0
 

Author Comment

by:isnoend2001
ID: 39718210
No problem, because if 3 of the selected 6 gets hit then it pays 2
so 2 x bet(5) = 10
0
 

Author Comment

by:isnoend2001
ID: 39718214
see jpg3 of 6 hit
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 39718911
Where do I find the <- Spots Selected-> grid?
0
 

Author Comment

by:isnoend2001
ID: 39718917
Bottom left button says "SEE PAYS"
In frmCleoPayOut
this is the grid that determines the pays, based on spots selected
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39718949
Here's an updated project. The changes that I made are marked with
'new

Open in new window

. As far as the question you originally asked, all I did was to update lblMarked as the numbers are picked. I can't do anything else because (and I apologize for this) I still don't understand how a hit is determined. Let's say I select the number 21. Where do I look to see if that's a hit?
Marty-Keno1.zip
0
 

Author Comment

by:isnoend2001
ID: 39718990
Thanks
I guess i am not good at explaining.
This has nothing to do whether a number is hit or not.
I am only trying to show the wins in FlexStatus before the program is ran.
If their numbers are hit by the randomize hey can see how much they win.
If only number 21 is marked that is not enough for any win.
At least 3 numbers have to be selected to win anythingis how m
The left column in gridPayout calculates the number of hits
As you can see columns 1 & 2 hold no payouts
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39719243
I just noticed that you have Randomize several places in the program. To get the most random results you should just do it once and a good place for it to be in your program is in frmCleo_Form_Load which I've done in the attached. All changes are marked with 'new2. I also changed the BorderStyle of frmCleoPayOut to Fixed Single so that it can't be accidentally resized.

Attached is a zip that displays the 'Hits' and 'Win' numbers.

BTW if you need a routine to calculate the number of hits let me know.
Q-28317825-2.zip
0
 

Author Closing Comment

by:isnoend2001
ID: 39719280
Thanks for all your help.Glad you finally got my poor instructions
I had a major problem with the randomizing numbers, but finally got it fixed.
http://www.vbforums.com/showthread.php?739943-RESOLVED-Random-Numbers-not-selected-properly-vb6&highlight=shuffle
The program i sent you was old with no OCX'S before the randomize was fixed. That was a major issue for some time.
 I ran your app and it does it, still gotta look at how you did it
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39719283
You're welcome and I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
0
 

Author Comment

by:isnoend2001
ID: 39719314
Hi MartinLiss
I hope you can answer a few improvements to your code seeing how you understand my poor needs. I will post another question as soon as determine the needs
Example:
 Hits reference the correct wins although the wins are not multiplied by the bet amount (lblBetCredits) and this can change if the bet one is increased.Also the numbers can be selected and unselected by dragging
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39719333
The first problem is easy to fix. Can you explain "Also the numbers can be selected and unselected by dragging"?
0
 

Author Comment

by:isnoend2001
ID: 39719351
Example click the top most button with the caption "Similiar card marking" and drag the numbers
0
 

Author Comment

by:isnoend2001
ID: 39719354
gotta run an errand be back in couple hours
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39719368
I see that now. I hope you don't mind my saying this (and it may be because I don't understand that grid's purpose) but it seems strange. Let's continue any further discussion in the new thread.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now