vb.net - VB6 到 VB.Net 的“命令”是什么?
问题描述
我正在将应用程序从 VB6 迁移到使用命令表达式的 VB.Net。
我的问题是:以下代码中 VB6命令的“等价物”是什么?$ 在 VB6 中返回字符串。所以我可以删除它......但即使在删除$之后, Command 也会给我一个错误,即Command 是一种接口类型,不能用作表达式。
我会尝试写'New Command().CommandText'来代替Command。这是正确的写作方式吗?
解决方案
VB6Command$
在 VB.NET 中的等效函数是Environment.CommandLine
请参考下面的代码示例:
Class Example
Public Shared Sub Main()
Console.WriteLine()
' Invoke this sample with an arbitrary set of command line arguments.
Console.WriteLine("CommandLine: {0}", Environment.CommandLine)
End Sub
End Class
' The example displays output like the following:
' C:\>CommandLine ARBITRARY TEXT
'
' CommandLine: CommandLine ARBITRARY TEXT
如果你想得到一个命令行参数的数组,你可以使用Environment.GetCommandLineArgs
推荐阅读
- vue.js - 单击一个缺席按钮后,将选择所有其他缺席按钮。我只想一次只选择一个不存在的按钮
- django - 为什么我在 djangorestframework-jwt 中得到这个输出
- angular-material - 在菜单中选择
- react-native - 如何在本机反应中进行反向地理编码
- json - 在使用 swift encodable 编码数据时,我们如何不将 json 字符串化?
- r - 如何将第一行的字符串与数据框中的每一行进行比较并计算 R 中不匹配的数量?
- python - 如何让您的 Discord 机器人说出具体内容,然后删除上一条消息
- xamarin - Xamarin 表单应用无法部署到 Android 10 真机
- mysql - 将特殊字符插入mysql数据库
- angular - Angular 库 PROD 构建引发异常