help plz :D
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
yesterday i watched 20 tutorials and made them i think i can do anything in vb now im so good
loove; clapper; clapper; fight; omg; hehaho; wahooo;
but :( there is one problem
if i have
dim score as integer
btn1 if clicked >> score += <<
now if he go on new form
score is not there why?
because it should display score in new form but i cant get it
like i want dim score to be in all forums but its on only one?!
omg;
loove; clapper; clapper; fight; omg; hehaho; wahooo;
but :( there is one problem
if i have
dim score as integer
btn1 if clicked >> score += <<
now if he go on new form
score is not there why?
because it should display score in new form but i cant get it
like i want dim score to be in all forums but its on only one?!
omg;
try this: this will open a new form with the same SCORE as the first one , you will see the score
using the LABEL provided.
using the LABEL provided.
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim score As Integer
score += 1
Label1.Text = Label1.Text + score
Dim f As New Form1
f.Show()
f.Label1.Text = Label1.Text
End Sub
troop wrote:tyif you want ot bring the DIM SCORE AS INTEGER to the other form
i will ask my bro if this is the best way because he will come today
with the same value and the same name , then do like this. hope you'll like my idea...! :mrgreen:
on form 1:
Code: Select all
Public Class Form1
Dim score As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
score += 1
Label1.Text = Label1.Text + score
score = 0
Form2.Show()
Form2.Label1.Text = Label1.Text
End Sub
End Class
on form 2:
Code: Select all
Public Class Form2
Dim score As Integer = Form1.Label1.Text
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = Label1.Text + score
End Sub
End Class
its so complicated but is it that
in form 1 we put the score in a label
then in form2 will put the score from form1 label?
:mrgreen:
in form 1 we put the score in a label
then in form2 will put the score from form1 label?
:mrgreen:
troop wrote:its so complicated but is it thatyes
in form 1 we put the score in a label
then in form2 will put the score from form1 label?
:mrgreen:

i just discovered new way and easier it only need one line
instead of dim score as ……
we do shared score as …
it will make it shared between all forums
thanks anyway
loove; loove; loove; hehaho; hehaho; :oops: :P 
instead of dim score as ……
we do shared score as …
it will make it shared between all forums

thanks anyway


M1z23R wrote:Or just use public instead of sharedThough Public and Shared are very useful try not to expose important methods or functions with them. Because someone can just reference your app and use them as they like. (This is how programming horror movies start :lol: :lol: :lol: )
You can find me on Facebook or on Skype mihai_92b
how can public and shared be used by anyone?
if they can is there another word to share the dim between all forums without people can use it?
if they can is there another word to share the dim between all forums without people can use it?
Copyright Information
Copyright © Codenstuff.com 2020 - 2023