Avatar billede mr-bob Nybegynder
03. marts 2004 - 13:10 Der er 1 løsning

Vb determine?

hvad betyder detmermine i vb?

i denne kode

Dim operator
    Dim buffer
    Sub et_onclick
    display.value = display.value + "1"
    End Sub
    Sub to_onclick
    display.value = display.value + "2"
    End Sub
    Sub tre_onclick
    display.value = display.value + "3"
    End Sub
    Sub fire_onclick
    display.value = display.value + "4"
    End Sub
    Sub fem_onclick
    display.value = display.value + "5"
    End Sub
    Sub seks_onclick
    display.value = display.value + "6"
    End Sub
    Sub syv_onclick
    display.value = display.value + "7"
    End Sub
    Sub otte_onclick
    display.value = display.value + "8"
    End Sub
    Sub ni_onclick
    display.value = display.value + "9"
    End Sub
    Sub nul_onclick
    display.value = display.value + "0"
    End Sub
    Sub dot_onclick
    display.value = display.value + "."
    End Sub
    Sub plus_onclick
    call determine
    operator="plus"
    display.value=""
    End Sub
    Sub minus_onclick
    call determine
    operator="minus"
    display.value=""
    End Sub
    Sub gange_onclick
    call determine
    operator="multiply"
    display.value=""
    End Sub
    Sub divider_onclick
    call determine
    operator="divide"
    display.value=""
    End Sub
    Sub lig_onclick
    call determine
    operator=""
    display.value=buffer
    End Sub
    Sub reset_onclick
    call initialize
    End Sub
    Sub initialize
    buffer=""
    operator=""
    display.value=""
    End Sub
    Sub determine
    Dim result
    if Not isnumeric(display.value) Then display.value="0"                        'Isnummeric checker om "display.value" er et tal'
    if Not isnumeric(buffer) Then buffer="0"
    if operator="" Then result=csng(display.value)                                'Csng omdanner tal til værdier der går fra -3.402823E38 til -1.401298E-45 for negative værdier og fra 1.401298E-45 til 3.402823E38 for positive
    if operator="plus" Then result = csng(buffer) + csng(display.value)
    if operator="minus" Then result = csng(buffer) - csng(display.value)
    if operator="multiply" Then result = csng(buffer) * csng(display.value)
    if operator="divide" Then result = csng(buffer) / csng(display.value)
    buffer=result
    End Sub
Avatar billede nute Nybegynder
03. marts 2004 - 13:24 #1
det er et kald til en Sub der hedder 'determine':

Sub determine
    Dim result
    if Not isnumeric(display.value) Then display.value="0"                        'Isnummeric checker om "display.value" er et tal'
    if Not isnumeric(buffer) Then buffer="0"
    if operator="" Then result=csng(display.value)                                'Csng omdanner tal til værdier der går fra -3.402823E38 til -1.401298E-45 for negative værdier og fra 1.401298E-45 til 3.402823E38 for positive
    if operator="plus" Then result = csng(buffer) + csng(display.value)
    if operator="minus" Then result = csng(buffer) - csng(display.value)
    if operator="multiply" Then result = csng(buffer) * csng(display.value)
    if operator="divide" Then result = csng(buffer) / csng(display.value)
    buffer=result
End Sub

/nute
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester