注册 登录
编程论坛 VB.NET论坛

求助,VB代码转VBNET

loyxqing 发布于 2023-02-14 19:25, 1583 次点击
最近在转VB代码到,有个功能函数涉及到ARRAY的套用,发现怎么都运行不下去,提示属性缺少,求助下坛友
软件功能函数描述:
ChangeProperty <propertyArgs>
Structured array. The properties vary depending on the object.
Due to the number of potential configurations, it is recommended that you generate this script using the UI's Automation tab.
我想将下面VB代码直接转到vbnet,原Array需要去掉,不知道应该怎么转。

VB代码示例
oDesign.ChangeProperty Array("NAME:AllTabs",  _
                             Array("NAME:LocalVariableTab",   _
                                        Array("NAME:PropServers", "LocalVariables"),  _
                                        Array("NAME:NewProps", Array("NAME:BOT", "PropType:=", "VariableProp", "UserDef:=", true, "Value:=", "235mm"))
                                   )
                            )
 PYTHON代码示例
oDesign.ChangeProperty(
    [
        "NAME:AllTabs",
        [
            "NAME:LocalVariableTab",
            [
                "NAME:PropServers",
                "LocalVariables"
            ],
            [
                "NAME:NewProps",
                [
                    "NAME:K1",
                    "PropType:="        , "VariableProp",
                    "UserDef:="        , True,
                    "Value:="        , "235mm"
                ]
            ]
        ]
    ])                           
 
3 回复
#2
loyxqing2023-02-14 20:53
富商运行报错信息
只有本站会员才能查看附件,请 登录
#3
lgwd2023-03-30 20:09
与VB差的很远,可以说是两种语言了。从长远看,学习C#,从VB转到C#才是明智的选择!
#4
yuma2023-04-01 17:48
你上面代码是python语言的,不是VB的。

以下是将Python中的代码示例转换为的代码示例:


oDesign.ChangeProperty(
    New Object() {"NAME:AllTabs",
        New Object() {
            "NAME:LocalVariableTab",
            New Object() {
                "NAME:PropServers", "LocalVariables",
                New Object() {"NAME:NewProps",
                    New Object() {"NAME:BOT", "PropType:=", "VariableProp",
                        "UserDef:=", True, "Value:=", "235mm"}
                }
            }
        }
    })

请注意,由于和Python有不同的语法结构,因此在转换代码示例时需要做适当的调整和更改。
1