Solved

How to write a formula getting data from a flexigrid

Posted on 2013-12-13
24
239 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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
deleted the .SCC file trying again
0
 

Author Comment

by:isnoend2001
Comment Utility
still not success trying again
Keno-12-13-13.zip
0
 
LVL 45

Expert Comment

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

Author Comment

by:isnoend2001
Comment Utility
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
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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
Comment Utility
see jpg3 of 6 hit
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 45

Expert Comment

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

Author Comment

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

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
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
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
Example click the top most button with the caption "Similiar card marking" and drag the numbers
0
 

Author Comment

by:isnoend2001
Comment Utility
gotta run an errand be back in couple hours
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

13 Experts available now in Live!

Get 1:1 Help Now