Ok, I mostly used Python to learn programming.. I am now trying to learn VB.. This is my problem..It seems that tutorial after tutorial I read has no examples as I am trying to do..

1. Dim x As Integer = 100
# this should make x = 100 right?
2.Private Sub Label4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.TextChanged
# this should handle the lable4 to be ready to display something.
3. Label4.Text = x
# this should make x show up in label4 right? But it dose not..As I said im used to python and maybe I am still thinking that way..

Basicly I want to make x a number and make it show up and and be able to change if I so to choose to make it do so, but mostly I want it to show up in label4..

not like that. like :

Private Sub Form_Load()
Dim x As Integer
x = 100
Label4.Caption = x
End Sub

not like that. like :

Private Sub Form_Load()
Dim x As Integer
x = 100
Label4.Caption = x
End Sub

Hi Abo Taher

I want to say thanks to you for the effort you did trying to help people in the forum, and for the effort helping the PO in his problem.

Just a couple of note
1- If you read the PO question you will notice he is trying to learn vb, so your answer should be somehow clear and simple and it has no mistake in it because that will confuse the PO more than he already confused trying to solve his problem.

2- your first word to him was "not like that. like :"
well, it seems that you are very sure about it, since you did not say "try this" or "test this way" ?
let me ask you this
A- Did you notice from his question that he is asking question about vb.net? you should notice that from his first line "Dim x As Integer = 100"
B- your answer works in vb6 and his question was in vb.net, do you know vb.net?

Just be careful when you post an answer especially if the person asking the question is newbie and still learning.

Ok, I mostly used Python to learn programming.. I am now trying to learn VB.. This is my problem..It seems that tutorial after tutorial I read has no examples as I am trying to do..

1. Dim x As Integer = 100
# this should make x = 100 right?
2.Private Sub Label4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.TextChanged
# this should handle the lable4 to be ready to display something.
3. Label4.Text = x
# this should make x show up in label4 right? But it dose not..As I said im used to python and maybe I am still thinking that way..

Basicly I want to make x a number and make it show up and and be able to change if I so to choose to make it do so, but mostly I want it to show up in label4..

Hi Clueless86

All your approach and thinking are correct.

That should work fine if you declare the integer inside the Label4_TextChanged , where did you put Dim x As Integer = 100

As it looks for now, the label changes it's text to 100 when the label text is changed. But there is nothing that trigger the textchanged method.

I recommend using the code that abu taher wrote or, to make it even more clear, put it in a button_klick method so when you click the button, label 4 will display 100.

If you are going to do math calculations integer is fine, but if you want to display more in the label you could change x to a string.
That makes it possible for you to do the following:

x = x & " apples"
label4.text = x

or

label4.text = x & " apples"

notice in the second version that x does not contain " apples" but the label does.

Good luck!

As it looks for now, the label changes it's text to 100 when the label text is changed. But there is nothing that trigger the textchanged method.

Could you please make this little tiny small test for me?

Create a new form, add a label which is by default will be Label1
in Label1_TextChanged you just put

Msgbox ("Heyy, I had been triggered !!!")

Run the form and tell me your result ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.