string - 获取字符串值形式的 VB6 变量名称

标签 string debugging parsing vb6

我想获取一个 VB6 变量的名称作为字符串值,以便在我正在使用的日志记录工具中处理它,如下所示(请检查!!!VariableName!!!)。

有什么办法可以实现这一点吗?我对 VB6 还很陌生,我应该维护和调试现有的旧 VB6 代码。

Public Sub AddVariableValue2Log(ByVal checkDebug, _
                                ByVal sFunctionName As String, _
                                ByVal sVariableValue As String, _
                                ByVal sTimeStamp As String)

  If checkDebug Then
    Dim sLogPath As String
    sLogPath = "C:\Temp\Log_" & sTimeStamp & ".txt"

    Dim fn As Integer
    fn = FreeFile

    Open sLogPath For Append As #fn
    Write #fn, Now & "|" & sFunctionName & "|>>>!!!VariableName!!! value: [" & sVariableValue & "]"
    Close #fn
  End If

End Sub

最佳答案

这在 VB6 中是不可能的。您必须传递变量的名称。

AddVariableValue2Log(True, "MyFunction", "MyVariable", MyVariable, Now())

关于string - 获取字符串值形式的 VB6 变量名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11985293/

相关文章:

javascript - ANTLR4 JavaScript 解析器 : how to catch an error in parsing

.net - 如何连接 ArrayList 的元素将其转换为字符串表示形式?

string - 使用powershell预处理html数据

java - WELD-000119 : Not generating any bean definitions from because of underlying class loading error

javascript - 如何在没有禁令的情况下解析 Steam 用户库存

c++ - 迭代正则表达式匹配

java - java中的字符串匹配

java - 将空格替换为连字符

python - 如何使用 python 在 VSCode 上调试 Google Code Jam 交互问题?

c - gdb :add excecutable in runtime