gpt4 book ai didi

vb.net - 无法索引,因为它没有默认属性错误

转载 作者:行者123 更新时间:2023-12-04 18:22:40 25 4
gpt4 key购买 nike

你好,我在 VB NET 中比较新。
所以,也许我的问题会显得幼稚。

VB代码:

 Public Class InputBox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim a, b, S, p
a = InputBox("Enter length")
b = InputBox("Enter width")
S = a * b
p = a + a + b + b
End Sub

End Class

在 InputBox 行中我收到此错误:
  Class 'LearningVB.InputBox' cannot be indexed because it has no default property 

这个错误是什么意思?

知道如何解决这个问题吗?

最佳答案

InputBox是一个类,如此处声明的:

Public Class InputBox

如果您尝试使用 the built-in VB helper function ,我怀疑您需要更改类的名称(这听起来是个好主意)或完全限定函数调用。 (老实说,我什至不完全确定你会怎么做……)

关于vb.net - 无法索引,因为它没有默认属性错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10337524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com