Michael
Michael

Reputation: 13626

cannot be indexed because it has no default property error

Hello im newer in VB NET. So, maybe my question will be seem naive.

VB code:

 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

in InputBox lines i get this error:

  Class 'LearningVB.InputBox' cannot be indexed because it has no default property 

What this error means?

And any idea how can i solve the problem?

Upvotes: 2

Views: 5387

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502036

InputBox is a class, as declared here:

Public Class InputBox

If you're trying to use the built-in VB helper function, I suspect you'll need to either change the name of your class (which sounds like it would be a good idea) or fully-qualify the function call. (I'm not even entirely sure how you'd do that, to be honest...)

Upvotes: 4

Related Questions