I am getting an error with this statement and can not seem to figure out what is wrong.

decMortgagePayment.ToString("C") & " Monthly Payment" = Me.lblMortgagePayment.Text

I am doing a calculation and want to put the results of the calculation in lblMortgagePayment. I get the error for this line, end of statement expected.
Help please,
Ken

Recommended Answers

All 8 Replies

The two lines have to be on the same line.

First off, it's on the same line. but Try this:

Me.lblMortgagePayment.Text = (decMortgagePayment) & " Monthly Payment "

I am not too sure that is 100% correct because I am work but you got it the wrong way round.

>> I am doing a calculation and want to put the results of the calculation in lblMortgagePayment
you want to put the result in lblMortgagePayment, but you put wrong assignment in your code.
Mr Brownstone was give the answer.

to Section
End of statment expected

Easy!

decMortgagePayment.ToString("C") & " Monthly Payment" = Me.lblMortgagePayment.Text

Should be the other way around for a start

Me.lblMortgagePayment.Text = decMortgagePayment.ToString("C") & "Monthly Payment"

Also is the Monthly Payment defined as something or do you want it to literally be a string?

If it's defined as something, e.g.

dim MonthlyPayment as string

then using quotes (" ") around it would be incorrect as putting it inside quotes would take it literally as a string.

I would try something like this

Me.lblMortgagePayment.Text = decMortgagePayment.ToString() & " Monthly Payment"

Don't know what the "C" inside the ToString() was for so i've left it out.

Let me know if that helps

- Jordan

@Keerthi_1,
Please avoid terms like this... Because this is a community which serves for online help to programers. If you wish to scold him please send a PM to him...

Anyway What you mean is right ;) Lolz...

I am extremly sorry sir i am actually i message for my friend unfortunally that message is sended for you sorry!!!!!

@Keerthi_1,

Its a common post. So not only me it will be visible to all.

If u wanna message your friend, U have to go to private message menu on the top of the page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.