![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
June 24, 2011, 01:39:39 PM |
|
Actually, the code's so simple I might as well post it here. Contents of the form, minus the properties section.
Private d As Double Private c As Double Private a As Double Private b As Double Private dnc As Boolean Private tmh As Double Private tmm As Double Private tmd As Double Private indbl As Double Private basea Private baser
Private Sub Command1_Click() On Error GoTo nosubnoa d = Text3.Text a = Text4.Text / Text2.Text b = d / a 'Text5.Text = Int(b) 'Text6.Text = Int(b / 1000000) 'Text7.Text = Int(b / 1000000000) Text5.Text = b Text6.Text = Int((b / 1000000) * 100000) / 10000 Text7.Text = Int((b / 1000000000) * 100000) / 100000 Exit Sub nosubnoa: MsgBox "Enter a valid value." End Sub
Private Sub Command2_Click() On Error GoTo nosubnob a = Text3.Text b = Text14.Text c = a / b d = c * Text2.Text tmm = d tmh = d / 60 tmd = d / 60 / 24 Text15.Text = Int(tmm) Text16.Text = Int(tmh) Text17.Text = Int(tmd) tmdc = Int(tmd) tmhc = Int(tmh - tmdc * 24) tmmc = Int(tmm - tmhc * 60 - tmdc * 60 * 24) Text18.Text = tmdc & " days, " & tmhc & " hours, " & tmmc & " minutes per block."
Text13.Text = Text14.Text / 1000000 Text12.Text = Text14.Text / 1000000000 'Text18.Text = Int(d / 60 / 24) & " days, " & (Int(d / 60) - Int(d / 60 / 24) * 60) & " hours, " & _ Int(d - (Int(d / 60) - Int(d / 60 / 24) * 60) * 60) & " minutes." Exit Sub nosubnob: MsgBox "Enter a valid value." End Sub
Private Sub Command3_Click() On Error GoTo nosubnoc a = Text3.Text b = Text13.Text * 1000000 c = a / b d = c * Text2.Text tmm = d tmh = d / 60 tmd = d / 60 / 24 Text15.Text = Int(tmm) Text16.Text = Int(tmh) Text17.Text = Int(tmd) tmdc = Int(tmd) tmhc = Int(tmh - tmdc * 24) tmmc = Int(tmm - tmhc * 60 - tmdc * 60 * 24) Text18.Text = tmdc & " days, " & tmhc & " hours, " & tmmc & " minutes per block." Text14.Text = Text13.Text * 1000000 Text12.Text = Text13.Text / 1000 'Text18.Text = Int(d / 60 / 24) & " days, " & (Int(d / 60) - Int(d / 60 / 24) * 60) & " hours, " & _ Int(d - (Int(d / 60) - Int(d / 60 / 24) * 60) * 60) & " minutes." Exit Sub nosubnoc: MsgBox "Enter a valid value." End Sub
Private Sub Command4_Click() On Error GoTo nosubnod a = Text3.Text b = Text12.Text * 1000000000 c = a / b d = c * Text2.Text tmm = d tmh = d / 60 tmd = d / 60 / 24 Text15.Text = Int(tmm) Text16.Text = Int(tmh) Text17.Text = Int(tmd) tmdc = Int(tmd) tmhc = Int(tmh - tmdc * 24) tmmc = Int(tmm - tmhc * 60 - tmdc * 60 * 24) Text18.Text = tmdc & " days, " & tmhc & " hours, " & tmmc & " minutes per block." Text14.Text = Text12.Text * 1000000000 Text13.Text = Text12.Text * 1000 'Text18.Text = Int(d / 60 / 24) & " days, " & (Int(d / 60) - Int(d / 60 / 24) * 60) & " hours, " & _ Int(d - (Int(d / 60) - Int(d / 60 / 24) * 60) * 60) & " minutes." Exit Sub nosubnod: MsgBox "Enter a valid value." End Sub
Private Sub Command5_Click() On Error GoTo nolol baser = InputBox("Enter hashrate in hash/s." & vbNewLine & "Add 000 000 000 for ghash/s. Eg." & vbNewLine & vbNewLine & "1972 ghash/s = 1972 000 000 000 hash/s.") / 1000000000 basea = InputBox("Time in minutes to find a block at " & baser & " ghash/s?") Text1.Text = baser / 1000000000 Text8.Text = baser / 1000000 Text2.Text = basea Exit Sub nolol: MsgBox "Edit cancelled." End Sub
Private Sub Command6_Click() End End Sub
Private Sub Form_Load() basea = 78 baser = 1972 End Sub
Private Sub insmnubut_Click() MsgBox "Bitcoin ref-based calc, 1.0" & vbNewLine & vbNewLine & _ "This calculator does not attempt to approximate time " & vbNewLine & _ "to completion via the difficulty. Rather, you can input " & vbNewLine & _ "a known set of values - for instance, the hashrate and " & vbNewLine & _ "average findrate of a given mining pool - and calculate " & vbNewLine & _ "your performance based on that." & vbNewLine & vbNewLine & _ "Please note the default time ratio is relevant as of 24/6/11." & vbNewLine & _ "The program makes no attempt to correct this ratio via " & vbNewLine & _ "difficulty, and so you will NEED TO MANUALLY SET IT " & vbNewLine & _ "YOURSELF. It's self-explanitory. Enter hashrate in hash/s," & vbNewLine & _ "not khash, mhash or ghash/s." & vbNewLine & vbNewLine & _ "TO calc by time, simply enter the time in minutes you " & vbNewLine & _ "want to take to generate a block at the power of the " & vbNewLine & _ "reference miner, and click Calculate to see the required" & vbNewLine & _ "hashrate. Twice the time will require half the power." & vbNewLine & vbNewLine & _ "TO calc by hashrate is fairly self-explanitory. Enter your" & vbNewLine & _ "desired rate in the relevant box and hit the button next " & vbNewLine & _ "to it. Results appear directly beneath - the minutes, " & vbNewLine & _ "hours and days are each totals." & vbNewLine & vbNewLine & _ "Brought to you by Ruski."
End Sub
Private Sub mnuabt_Click() MsgBox "Brought to you by Ruski." & vbNewLine & vbNewLine & _ "I know you have no idea of whom Ruski may be." & vbNewLine & vbNewLine & _ "I'm also quite OK with this." & vbNewLine & vbNewLine & _ "Enjoy responsibly." End Sub
Private Sub mnuexit_Click() End End Sub
Private Sub Text1_Change() On Error GoTo nochangea If dnc = True Then Exit Sub dnc = True Text3.Text = Text1.Text * 1000000000 Text8.Text = Text1.Text * 1000 indbl = basea * (baser / Text1.Text) Text2.Text = Int(indbl) dnc = False nochangea: dnc = False Exit Sub End Sub
Private Sub Text3_Change() On Error GoTo nochangeb If dnc = True Then Exit Sub dnc = True Text1.Text = Text3.Text / 1000000000 Text8.Text = Text3.Text / 1000000 dnc = False indbl = basea * (baser / Text1.Text) Text2.Text = Int(indbl) Exit Sub nochangeb: dnc = False Exit Sub End Sub
Private Sub Text8_Change() On Error GoTo nochangec If dnc = True Then Exit Sub dnc = True Text3.Text = Text8.Text * 1000000 Text1.Text = Text8.Text / 1000 dnc = False indbl = basea * (baser / Text1.Text) Text2.Text = Int(indbl) nochangec: dnc = False Exit Sub End Sub
|