HawaiiDragon
asked on
adding text to an anser in a textbox with a numercial answer in it
Hello again experts I have a new problem
I have 3 textbox fields 1 contains a name the other two have numerical values that I have converted into a percentage to be displayed in a text box.
my problem is this I don't know how to display the text with the answer in the middle of the text box!
tbresult needs to say = 'The' + tbname.text + 'won' + tbresult.Text = FormatNumber(((a / (a + b) * 100)), 3).ToString + of thier games so far this year.
Thanx in advance
Below is my code
I have 3 textbox fields 1 contains a name the other two have numerical values that I have converted into a percentage to be displayed in a text box.
my problem is this I don't know how to display the text with the answer in the middle of the text box!
tbresult needs to say = 'The' + tbname.text + 'won' + tbresult.Text = FormatNumber(((a / (a + b) * 100)), 3).ToString + of thier games so far this year.
Thanx in advance
Below is my code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As Integer
a = tbwon.Text
b = tblost.Text
tbresult.Text = FormatNumber(((a / (a + b) * 100)), 3).ToString
End Sub
ASKER
Error 1 Value of type 'String' cannot be converted to 'System.Windows.Forms.Text Box'. C:\Documents and Settings\rshier\Local Settings\Application Data\Temporary Projects\Baseball\Form1.vb 9 20 Baseball
ASKER
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As Integer
a = tbwon.Text
b = tblost.Text
tbresult = "The " & tbname.text.tostring & " won " & FormatNumber(((a / (a + b) * 100)), 3).ToString & " of their games so far this year."
Gennerates the error Value of type 'String' cannot be converted to 'System.Windows.Forms.Text Box'.
Why I wonder.
End Sub
Dim a, b As Integer
a = tbwon.Text
b = tblost.Text
tbresult = "The " & tbname.text.tostring & " won " & FormatNumber(((a / (a + b) * 100)), 3).ToString & " of their games so far this year."
Gennerates the error Value of type 'String' cannot be converted to 'System.Windows.Forms.Text
Why I wonder.
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Change nepaulz answer to read:
tbresult.Text = "The " & tbname.text.tostring & " won " & FormatNumber(((a / (a + b) * 100)), 3).ToString & " of their games so far this year."
Ah. I see you beat me to it.
Well done. Carry on.
Well done. Carry on.
ASKER
thank you very much. I am sure to post more VB in the future!
Open in new window