Need help with a basic visual basic program.

Started by
3 comments, last by u235 18 years, 1 month ago
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

Advertisement
Try changing TextBox5.Name to TextBox5.Text
Quote:Original post by CadeF
Try changing TextBox5.Name to TextBox5.Text

I think he means Label3 and not TextBox5.
The best way to predict the future is to invent it.
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.
Quote:Original post by spacemonkey90
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.


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
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...

This topic is closed to new replies.

Advertisement