Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 259

# How to write a formula getting data from a flexigrid

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 ?See jpg
0
isnoend2001
• 15
• 9
1 Solution

Retired ProgrammerCommented:
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 Commented:
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 Commented:
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 Commented:
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 Commented:
deleted the .SCC file trying again
0

Author Commented:
still not success trying again
Keno-12-13-13.zip
0

Retired ProgrammerCommented:
OK I have the project running. What specifically would you like help with?
0

Author Commented:
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 Commented:
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
0

Retired ProgrammerCommented:
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

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

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

Author Commented:
see jpg
0

Retired ProgrammerCommented:
Where do I find the <- Spots Selected-> grid?
0

Author Commented:
Bottom left button says "SEE PAYS"
In frmCleoPayOut
this is the grid that determines the pays, based on spots selected
0

Retired ProgrammerCommented:
Here's an updated project. The changes that I made are marked with
'new
. 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 Commented:
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

Retired ProgrammerCommented:
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 Commented:
I had a major problem with the randomizing numbers, but finally got it fixed.
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

Retired ProgrammerCommented:
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 Commented:
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

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

Author Commented:
Example click the top most button with the caption "Similiar card marking" and drag the numbers
0

Author Commented:
gotta run an errand be back in couple hours
0

Retired ProgrammerCommented:
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

• 15
• 9
Tackle projects and never again get stuck behind a technical roadblock.