我知道这是一个新手问题,但是如何在不创建表单的情况下在 visual studio 中运行简短的 vb.net 函数?我目前正在处理家庭作业问题,想通过将答案输入 visual studio 来仔细检查我的答案,但似乎无法弄清楚该怎么做。
这就是我要运行的,例如:
Dim num as Integer = 30
If num > 20 Then
num -= 10
If num < 20 Then
num *= 2
Else
num /= 2
End if
Else
If num > 10 Then
num += 2
End If
End If
DisplayTextBox.Text = CStr(num)
最佳答案
为了对功能进行简单检查,我倾向于使用控制台应用程序。但是 DisplayTextBox.Text 对象是表单应用程序的一部分,所以我会使用控制台进行输出
Module Module1
Sub Main()
Dim num As Integer = 30
If num > 20 Then
num -= 10
If num < 20 Then
num *= 2
Else
num /= 2
End If
Else
If num > 10 Then
num += 2
End If
End If
Console.WriteLine(num)
End Sub
End Module
编辑添加链接
关于vb.net - 如何在不创建表单的情况下在 visual studio 中运行简单的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53990945/