Results 1 to 8 of 8

Hybrid View

  1. #1
    pushdis15's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    spokane washington
    Posts
    923
    Reputation
    20
    Thanks
    170
    My Mood
    Twisted

    [help] KDR Calculator

    ok i got it but for some reason i get this error and i dont know want it means ? any help ? ty

    Code:
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            Function FKDR(ByVal Kills As String, ByVal Deaths As String, ByVal KDR As String)
            Dim Result As Double
            If KDR = 0 Then
                Result = Kills / Deaths
            Else
                Result = KDR * Kills - Deaths
            End If
            If KDR < 1 Then
                Return Format(Result, "0.00")
            Else
                Return Format(Result, "0")
            End If
        End Function
    PlayStation ID:
    Boxing509

    Quote Originally Posted by pushdis15
    Women now have choices. They can be married, not married, have a job, not have a job, be married with children, unmarried with children. Men have the same choice we've always had: work, or prison.

  2. #2
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,843
    Reputation
    425
    Thanks
    8,616
    You're putting a function in a sub.
    Last edited by NOOB; 01-19-2011 at 09:24 AM.

  3. #3
    pushdis15's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    spokane washington
    Posts
    923
    Reputation
    20
    Thanks
    170
    My Mood
    Twisted
    D: wow lol
    PlayStation ID:
    Boxing509

    Quote Originally Posted by pushdis15
    Women now have choices. They can be married, not married, have a job, not have a job, be married with children, unmarried with children. Men have the same choice we've always had: work, or prison.

  4. #4
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,409
    My Mood
    In Love
    I PMEd him something different. Consider this thread as Solved
    No I do not make game hacks anymore, please stop asking.

  5. #5
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,843
    Reputation
    425
    Thanks
    8,616
    Quote Originally Posted by flameswor10 View Post
    I PMEd him something different. Consider this thread as Solved
    Code:
    Function KDR(ByVal Kills As Integer, ByVal Deaths As Integer)
            Dim KDR As Double = Kills / Deaths
            Return KDR.ToString("N2")
    End Function

  6. #6
    Gordon`'s Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    283
    Reputation
    24
    Thanks
    325
    if Deaths is 0 it triggers a divide by 0 exception.


  7. #7
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    You've got a function in a sub, possibly dividing by zero.. and you're checking and multiplying strings |:

    Will post corrected code when I get home

  8. #8
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,843
    Reputation
    425
    Thanks
    8,616
    Why would someone use a KDR calculator if they had no deaths?