Clearing values of variables???

  • 16 years ago

    My question is - how to clear variable in code?
    I don't want to declare different variables for all my functions...
    I've got 20 functions, that are running in application everytime i run it.
    In every function i'm using the same variable.
    My code read from registry values of keys. Everything is ok, but:


    1) function is running and reading from registry (key exist)
    2) next reading (key doesn't exist, but code take value from previous
    function...)
    It must clear, because declaration dwValue = 0 gives me "disable" value of a
    key...
    Function TcpMaxConnectResponseRetransmissions(ByVal strKomputer As String)
    dim oreg
    Dim dwValue
    oreg = GetObject("winmgmts:{impersonationLevel=impersonate}!\" &
    strKomputer & "\root\defaulttdRegProv")
    Dim vTcpMaxConnectResponseRetransmissions
    Dim strKeyPath = "System\CurrentControlSet\Services\Tcpip\parameters"
    Dim strValueName = "TcpMaxConnectResponseRetransmissions"
    oreg.getdwordValue(HKEYLOCALMACHINE, strKeyPath, strValueName, dwValue)
    If dwValue.ToString = Nothing Then
    vTcpMaxConnectResponseRetransmissions = "Brak"
    ElseIf dwValue = 1 Then
    vTcpMaxConnectResponseRetransmissions = "Enabled"
    ElseIf dwValue = 0 Then
    vTcpMaxConnectResponseRetransmissions = "Brak"
    End If
    Return vTcpMaxConnectResponseRetransmissions
    End Function


Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In order to understand recursion, one must first understand recursion.”