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.
12 posts Page 1 of 2
Contributors
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

help plz :D
troop
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;
User avatar
noypikami
VIP - Donator
VIP - Donator
Posts: 151
Joined: Sat Dec 22, 2012 1:49 am

Re: help plz :D
noypikami
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.
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
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: help plz :D
troop
ty
i will ask my bro if this is the best way because he will come today :D
User avatar
noypikami
VIP - Donator
VIP - Donator
Posts: 151
Joined: Sat Dec 22, 2012 1:49 am

Re: help plz :D
noypikami
troop wrote:
ty
i will ask my bro if this is the best way because he will come today :D
if you want ot bring the DIM SCORE AS INTEGER to the other form
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
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: help plz :D
troop
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:
User avatar
noypikami
VIP - Donator
VIP - Donator
Posts: 151
Joined: Sat Dec 22, 2012 1:49 am

Re: help plz :D
noypikami
troop wrote:
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:
yes :) that's what i mean to bring the value of the integer from FORM1 (score) to FORM2
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: help plz :D
troop
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 :D
thanks anyway :D loove; loove; loove; hehaho; hehaho; :oops: :P :D
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: help plz :D
M1z23R
Or just use public instead of shared :D
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: help plz :D
XTechVB
M1z23R wrote:
Or just use public instead of shared :D
Though 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
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: help plz :D
troop
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?
12 posts Page 1 of 2
Return to “Coding Help & Support”