Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I keep getting the following errors in my program:

'System.Windows.Forms.TextBox.Text' is a 'property' but used like a 'method'

and

Non-invocable member 'System.Windows.Forms.Control.Text' cannot be used like a method.

Here is the code:

if (OffenceBox.Text != "")
   {
 AddBook(int.Parse(AgeBox.Text), NameBox.Text, AddressBox.Text, (HeightBox.Text), OffenceBox.Text());
   }
   else
   {
   MessageBox.Show("Age must be max 3 numbers in length");
   }
   }

How can I fix this problem?

EDIT: Fixed the error and now encountered another: Argument 4: Cannot convert String to int and I can't seem to fix the problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
590 views
Welcome To Ask or Share your Answers For Others

1 Answer

Where you've written "OffenceBox.Text()", you need to replace this with "OffenceBox.Text". It's a property, not a method - the clue's in the error!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...