VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank f

by Jan Lovfold (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th August 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank for a loan. If you want the complete game,

API Declarations



Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank for a loan. If you want the complete game, email me at [email protected]

Rate Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank f






If lblcounter.Caption <> 19 Then
Dim number1 As Integer
Dim number2 As Integer
Dim number3 As Integer
Dim number4 As Integer
Dim number5 As Integer
Dim number6 As Integer
Dim i As Integer

Randomize
  number1 = Int(((700 - 500) * Rnd()) + 500)
Randomize
  number2 = Int(((1400 - 1100) * Rnd()) + 1100)
Randomize
  number3 = Int(((40 - 10) * Rnd()) + 10)
Randomize
  number4 = Int(((400 - 100) * Rnd()) + 100)
Randomize
  number5 = Int(((300 - 270) * Rnd()) + 270)
Randomize
  number6 = Int(((100 - 20) * Rnd()) + 20)
Randomize
  i = Rnd(1) * 20

Text1.Text = number1
Text2.Text = number2
Text3.Text = number3
Text4.Text = number4
Text5.Text = number5
Text6.Text = number6
Dim day As Integer
day = lblcounter.Caption
day = day + 1
lblcounter.Caption = day
Else
Dim message As String
message = MsgBox("this is your last day. Better empty your stock!!")
lblcounter.Caption = 20
End If



If lblcounter.Caption = 21 Then
Dim endmessage As Integer
Dim cash As Long
Dim result As Long
cash = lblcash.Caption
result = cash - 50000
endmessage = MsgBox("The period is over! You came out with a revenue of " & result & "")
Unload Me
End
Else
End If



If Not lblloan.Caption = "" Then

    If lbldays.Caption > 0 Then
    Dim daysleft As Integer
    daysleft = lbldays.Caption
    daysleft = daysleft - 1
    lbldays.Caption = daysleft

    Else
    Dim loan As Long
    Dim currentcash As Long
    loan = lblloan.Caption
    currentcash = lblcash.Caption
    message = MsgBox("Message from the bank! We want our money!!! " & loan & " will be subtracted from your account.", vbOKOnly, "PayBack time!!!")
    result = currentcash - loan
    lblcash.Caption = result
    lblloan.Caption = ""
    lbldays.Caption = ""
        If result < 0 Then
        message = MsgBox("oops.. out of money!! try again", vbOKOnly, "oops")
        Else
        End If
        
    End If

Else
End If












End Sub

Private Sub cmdloan_Click()
frmloan.Show
frmloan.Visible = True

End Sub

Private Sub Command1_Click()

Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall1.Caption
nr_kurs = Text1.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash

antall = lblantall1.Caption
lblantall1.Caption = message + antall

gammeltotal = lblpris1.Caption
lblpris1.Caption = nr_kurs

lblantall1.Visible = True
lblpris1.Visible = True
lblfirma1.Visible = True


Else
message = MsgBox("You can`t afford it!! Maybe you should consider going to the bank???", vbOKOnly, "need more cash")
End If


End Sub

Private Sub Command10_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text4.Text
antall = lblantall4.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall4.Caption = "0"
lblantall4.Visible = False
lblpris4.Caption = "0"
lblpris4.Visible = False
lblfirma4.Visible = False
End Sub

Private Sub Command11_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text5.Text
antall = lblantall5.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall5.Caption = "0"
lblantall5.Visible = False
lblpris5.Caption = "0"
lblpris5.Visible = False
lblfirma5.Visible = False
End Sub

Private Sub Command12_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text6.Text
antall = lblantall6.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall6.Caption = "0"
lblantall6.Visible = False
lblpris6.Caption = "0"
lblpris6.Visible = False
lblfirma6.Visible = False
End Sub

Private Sub Command2_Click()
Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall2.Caption
nr_kurs = Text2.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash
'regne ut totalt antall aksjer
antall = lblantall2.Caption
lblantall2.Caption = message + antall
'regne ut total utgift på aksjene
gammeltotal = lblpris2.Caption
lblpris2.Caption = nr_kurs

lblantall2.Visible = True
lblpris2.Visible = True
lblfirma2.Visible = True


Else
message = MsgBox("You can`t afford it!!", vbOKOnly, "need more cash")
End If
End Sub

Private Sub Command3_Click()
Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall3.Caption
nr_kurs = Text3.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash
'regne ut totalt antall aksjer
antall = lblantall3.Caption
lblantall3.Caption = message + antall
'regne ut total utgift på aksjene
gammeltotal = lblpris3.Caption
lblpris3.Caption = nr_kurs

lblantall3.Visible = True
lblpris3.Visible = True
lblfirma3.Visible = True


Else
message = MsgBox("You can`t afford it!!", vbOKOnly, "need more cash")
End If
End Sub

Private Sub Command4_Click()
Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall4.Caption
nr_kurs = Text4.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash
'regne ut totalt antall aksjer
antall = lblantall4.Caption
lblantall4.Caption = message + antall
'regne ut total utgift på aksjene
gammeltotal = lblpris4.Caption
lblpris4.Caption = nr_kurs

lblantall4.Visible = True
lblpris4.Visible = True
lblfirma4.Visible = True


Else
message = MsgBox("You can`t afford it!!", vbOKOnly, "need more cash")
End If
End Sub

Private Sub Command5_Click()
Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall5.Caption
nr_kurs = Text5.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash
'regne ut totalt antall aksjer
antall = lblantall5.Caption
lblantall5.Caption = message + antall
'regne ut total utgift på aksjene
gammeltotal = lblpris5.Caption
lblpris5.Caption = nr_kurs

lblantall5.Visible = True
lblpris5.Visible = True
lblfirma5.Visible = True


Else
message = MsgBox("You can`t afford it!!", vbOKOnly, "need more cash")
End If
End Sub

Private Sub Command6_Click()
Dim nr_new As Long
Dim nr_kurs As Long
Dim stock As Long
Dim cash As Long
Dim newcash As Long
Dim gammel As Long
Dim antall As Long
Dim nyantall As Long
Dim gammeltotal As Long


gammel = lblantall6.Caption
nr_kurs = Text6.Text
cash = lblcash.Caption

message = InputBox("How many stocks would you like to purchase?", "Purchase stocks??")


stock = nr_kurs * message

If lblcash.Caption > stock Then
'regne ut summen av penger igjen
newcash = cash - stock
lblcash.Caption = newcash
'regne ut totalt antall aksjer
antall = lblantall6.Caption
lblantall6.Caption = message + antall
'regne ut total utgift på aksjene
gammeltotal = lblpris6.Caption
lblpris6.Caption = nr_kurs

lblantall6.Visible = True
lblpris6.Visible = True
lblfirma6.Visible = True


Else
message = MsgBox("You can`t afford it!!", vbOKOnly, "need more cash")
End If
End Sub

Private Sub Command7_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text1.Text
antall = lblantall1.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall1.Caption = "0"
lblantall1.Visible = False
lblpris1.Caption = "0"
lblpris1.Visible = False
lblfirma1.Visible = False


End Sub

Private Sub Command8_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text2.Text
antall = lblantall2.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall2.Caption = "0"
lblantall2.Visible = False
lblpris2.Caption = "0"
lblpris2.Visible = False
lblfirma2.Visible = False
End Sub

Private Sub Command9_Click()
Dim kurs As Long
Dim antall As Long
Dim cash As Long
Dim gammelcash As Long
Dim nycash As Long
gammelcash = lblcash.Caption

kurs = Text3.Text
antall = lblantall3.Caption
cash = kurs * antall
nycash = gammelcash + cash
lblcash.Caption = nycash

lblantall3.Caption = "0"
lblantall3.Visible = False
lblpris3.Caption = "0"
lblpris3.Visible = False
lblfirma3.Visible = False
End Sub

Private Sub Picture1_Click()
Dim message As String
message = MsgBox("Made by Jan Lovfold. September 2003 Email:[email protected]", vbInformation, "Stock!")

End Sub


Download this snippet    Add to My Saved Code

Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank f Comments

No comments have been posted about Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank f. Why not be the first to post a comment about Complete Stock-Market game! Buy / sell stocks depending on the value. You can also visit the bank f.

Post your comment

Subject:
Message:
0/1000 characters