Solved

adding text to an anser in a textbox with a numercial answer in it

Posted on 2011-03-21
7
209 Views
Last Modified: 2012-05-11
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



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

Open in new window

0
Comment
Question by:HawaiiDragon
  • 3
  • 2
  • 2
7 Comments
 
LVL 17

Expert Comment

by:nepaluz
Comment Utility
change your last line to

tbresult = "The " & tbname.text.tostring & " won " & FormatNumber(((a / (a + b) * 100)), 3).ToString & " of their games so far this year."

Open in new window

0
 

Author Comment

by:HawaiiDragon
Comment Utility
Error      1      Value of type 'String' cannot be converted to 'System.Windows.Forms.TextBox'.      C:\Documents and Settings\rshier\Local Settings\Application Data\Temporary Projects\Baseball\Form1.vb      9      20      Baseball
0
 

Author Comment

by:HawaiiDragon
Comment Utility
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.TextBox'.

Why I wonder.



    End Sub
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
Comment Utility
tbresult.text = "The " & tbname.text.tostring & " won " & FormatNumber(((a / (a + b) * 100)), 3).ToString & " of their games so far this year."

Open in new window


the error is at the begining

tbresult = should be tbresult.text =
0
 
LVL 1

Expert Comment

by:B34RDY
Comment Utility
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."

Open in new window

0
 
LVL 1

Expert Comment

by:B34RDY
Comment Utility
Ah. I see you beat me to it.
Well done. Carry on.
0
 

Author Closing Comment

by:HawaiiDragon
Comment Utility
thank you very much. I am sure to post more VB in the future!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now