Need help with a basic visual basic program.

Recommended Posts

I useto be very learned in VB 6.0 but its been a while sence and now I have .net 2005. I have a text box and a label. Ive been trying to have it when a number is typed into the text box that the labels value will change based on this. Text box Label 1 -5 2-3 -4 4-5 -3 6-7 -2 8-9 -1 10-11 0 12-13 1 etc... For some reason a value never appears in the label. Nothing in my code seams to be off. But im not sure. Could anyone give me a little help debuging it?
    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
Dim Modtemp As Integer, counter As Integer
Modtemp = -5

Do While counter <= Val(TextBox5.Name)
Modtemp = Modtemp + 1
counter = counter + 2
Loop
Label13.Name = Modtemp.ToString
End Sub



Share on other sites
Try changing TextBox5.Name to TextBox5.Text

Share on other sites
Quote:
 Original post by CadeFTry changing TextBox5.Name to TextBox5.Text

I think he means Label3 and not TextBox5.

Share on other sites
I haven't been programming in Visual Basic for very long, but I think you need to replace the Label13.Name with Label13.caption. .text is only used when you want something to appear in a text box.

Share on other sites
Quote:
 Original post by spacemonkey90I haven't been programming in Visual Basic for very long, but I think you need to replace the Label13.Name with Label13.caption. .text is only used when you want something to appear in a text box.

Not true...in all my dealings with VB, the Text property is what I have modified for labels and everything thus far has gone smoothly. I'm not saying changing the Caption property won't work, I'm just saying that the Text property will also work.

-AJ

Create an account

Register a new account

• Partner Spotlight

• Forum Statistics

• Total Topics
627671
• Total Posts
2978550

• 11
• 10
• 10
• 12
• 22