-
Error in the code
Hey guys, while I was coding for my application. I ran into a problem
Here's my code
Code:
outputTextBox = outputTextBox &
(counter + 1).ToString().PadLeft(2) & TotalSales(counter).ToString("C2").PadLeft(16) & bonus(counter).ToString("C2").PadLeft(17)
& ControlChars.NewLine
It says " Operator '&' is not defined for types 'System.Windows.Forms.TextBox' and 'String"
Any help is appreciated! =)
-
Re: Error in the code
Think about what you actually want to do. Do you really want to join a String to a TextBox, or do you actually want to join a String to the contents of the TextBox? If it's the latter, how do you access the contents of a TextBox? Also, what do you really want to do with the result? Do you really want to replace the existing TextBox, or do you actually want to replace the contents of the TextBox?
-
Re: Error in the code
Thanks I actually figured it out.
Code:
outputTextBox.Text = outputTextBox.Text & Bonustable(row, 0).ToString.PadRight(3) & Bonustable(row, 1).ToString("c0").PadLeft(12) & Bonustable(row, 2).ToString("c0").PadLeft(12) & ControlChars.NewLine