blacklune
blacklune

Reputation: 43

MessageBox.Show() Error

The message box should display "The sum of the numbers 1 through 10 is 55." So I have to put two variables in a message box. like this one

MessageBox.Show("Sum of Numbers", "The sum of numbers 1 through " & intUserInput.ToString, " is " & dblTotal.ToString, MessageBoxButtons.OK)

but I'm getting an error - "Overload resolution failed because no accessible 'Show' can be called with these arguments"

Not sure if I understands why.

Upvotes: 0

Views: 1075

Answers (2)

Busch4Al
Busch4Al

Reputation: 53

You have an extra comma after ToString: intUserInput.ToString, " is "

Upvotes: 1

user1666620
user1666620

Reputation: 4808

You have a typo in your string concatenation - try the below

MessageBox.Show("The sum of numbers 1 through " & intUserInput.ToString & " is " & dblTotal.ToString, "Sum of Numbers", MessageBoxButtons.OK)

There was a comma after the intUserInput.ToString portion, which looked like a new parameter argument.

Upvotes: 3

Related Questions