winzip icon

Summary Stats Calc Updated 1.1

Email
Submitted on: 1/4/2017 9:13:02 AM
By: Eddie Bole 
Level: Intermediate
User Rating: Unrated
Compatibility: VB 6.0
Views: 776
 
     This is a Summary Stats Calculator (now Update Ver 1.1) that calculates the mean, mode, median and range of a set of numbers separated by commas. You can copy and paste the numbers into the input text box and press Enter. I fixed up 3 bugs so here is Revision 1.1 . Bugs were Numeric only entry (thanks Dave), Whole Entry Selection on Enter press, mixed digit length calculations gave incorrect answers (due to sort bug in the listbox so I padded the numbers with leading zero digits). I got rid of the nice morph textbox and replaced it with the standard VB6 one to enable numeric only entry. This calculator is for whole positive numbers only (no negative numbers or decimal numbers).

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 7 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/3/2017 10:04:05 AMdave Carter

Hi Eddie, I use the following code to set text box to number input only... however this will reject decimal and thousandths separators, so probably not what you are after, all the same and just in case it...
Alternatively, you may need a KeyPress algo to allow commas, spaces and numbers, HTH, dave

' API decs
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

' Constants
Const GWL_STYLE = (-16)
Const ES_NUMBER = &H2000

' Code
Sub SetNumTextOnly(hWnd As Long)
If hWnd Then
Dim iStyle As Long
iStyle = GetWindowLong(hWnd, GWL_STYLE)
iStyle = iStyle Or ES_NUMBER
SetWindowLong hWnd, GWL_STYLE, iStyle
End If
End Sub

(If this comment was disrespectful, please report it.)

 
1/3/2017 11:34:29 AM

Thanks Dave. I will try your suggestion. I kept on getting an error message that the method was not supported by the control, so I'm not sure if I have to add the extra feature to the control. Frustrated!
(If this comment was disrespectful, please report it.)

 
1/3/2017 7:02:22 PMdave Carter

Sorry Eddie, The project's Text Box Control won't accept the code I wrote previously because it's not a VB Text Box so a Key Press algo could be the way to go. p.s. The Text Box control is 'very lovely' and very excellent too :D
(If this comment was disrespectful, please report it.)

 
1/3/2017 9:34:25 PMdave Carter

Hi Eddie, again

I added this code after the ' sanity check comment code in UserControl.KeyPress routine,
it's pretty nasty code but seems to do the Numbers only bit plus space, comma and period

If mNumbersOnly Then ' new property
Select Case KeyAscii
Case 48 To 57 ' 0 - 9
Case 32 ' [space]
Case 44 ' [comma]
Case 46 ' period
Case Else ' e.g. None of the above
RaiseEvent KeyPress(KeyAscii)
Exit Sub
End Select
End If

It took a bit of playing around to find where to put the code and
I think you're right, you gonna have to add the feature outright

dave
(If this comment was disrespectful, please report it.)

 
1/4/2017 2:59:37 AM

Dave. Normally I am able to do the Numeric only feature with the vb textbox, but this Morph textbox control confused me. Can't wait to try it out. Once again, many thanks Dave.
(If this comment was disrespectful, please report it.)

 
1/4/2017 9:40:14 AMEddie Bole

Fixed a few things.
(If this comment was disrespectful, please report it.)

 
1/4/2017 11:23:43 AMKenaso

Eddie, I have a class called clsKeyEdit.cls that I used in many of my applications. Take a look and see if it can assist you in this problem.
(If this comment was disrespectful, please report it.)

 
1/4/2017 3:24:56 PMEddie Bole

Thanks Kenaso. I like playing around with various bits of code. Interesting Code is always welcome.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.