Tuesday, July 28, 2009

How do I take a value from text boxes and display it as a label in visual basic.?

I have to display a value as a label in visual basic. I have it setup where you enter values in text boxes. I have everything I need to get the answer I just don't know how to display the answer as a label.

How do I take a value from text boxes and display it as a label in visual basic.?
%26lt;label name%26gt;.text = %26lt;textbox%26gt;.text





so if your label was called label1 and your textbox was called textbox1 it would be





label1.text = textbox1.text;





dougc
Reply:label1.caption = text1.text
Reply:Like this:





label1.caption = text1.text





Place this code into the Change event for the textbox control, so when a character is typed, it will automatically update the label caption. You could also use it in a LostFocus event, so after your tab to another control the label would be updated with the textbox contents.





Private Sub Text1_Change()


Label1.Caption = Text1.Text


End Sub





or





Private Sub Text1_LostFocus()


Label1.Caption = Text1.Text


End Sub
Reply:EOQ = Sqrt ( 2 (Annual demand) (Ordering cost) / (Holding cost))





You are missing the * symbol for multiplication and the class name "Math"


EOQ = Math.Sqrt ( 2 * (Annual demand) *(Ordering cost) / (Holding cost))





Remember the hierarchy of math functions and check your use of parentheses


No comments:

Post a Comment