Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

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 ?User generated imageSee jpg
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

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.
Avatar of isnoend2001

ASKER

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
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
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
deleted the .SCC file trying again
still not success trying again
Keno-12-13-13.zip
OK I have the project running. What specifically would you like help with?
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
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

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?
No problem, because if 3 of the selected 6 gets hit then it pays 2
so 2 x bet(5) = 10
see jpgUser generated image
Where do I find the <- Spots Selected-> grid?
Bottom left button says "SEE PAYS"
In frmCleoPayOut
this is the grid that determines the pays, based on spots selected
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
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
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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
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
The first problem is easy to fix. Can you explain "Also the numbers can be selected and unselected by dragging"?
Example click the top most button with the caption "Similiar card marking" and drag the numbers
gotta run an errand be back in couple hours
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.