[2008] Refer To Variables In Other Forms?

Mar 6, 2009

I was wondering if i can refer to variable is in other forms. EG. i want to make a set homepage form, so i have my main browser form, and my Options from which has my "Set homepage" button. I want to know how i can set my homepage in form 1 via a button in form 2.

View 6 Replies


ADVERTISEMENT

VS 2008 Why Can't Use Variables Between Forms

Jul 5, 2009

I am making a program where in form 1, the user inputs data, and the data is used in form 2.[code]There are 12 number boxes and 12 text boxes. I also tried to use a label (label 4) to test if i could even use the variables on form 1. I can't. When you press the button, It clears the text box, and removes the label.

View 6 Replies

Forms :: Refer To Another Sub?

Nov 28, 2009

I have a program that used information form treenodes and put them in the textbox after timer ticks the problem is that i should use AddHandler for ticking, but i dont know how to refer to the title() and name() because they are not on the same sub private

[Code]....

View 1 Replies

Forms :: Refer To Object Via String?

Apr 21, 2010

I have a label testlabel. is there some way I can refer to it as:

dim t as string = "testlabel"
(something here referring to the OBJECT with the same name as the string).text = "mytext"

? I have 50 labels with text to change and would love to be able to:

for i = 1 to 50
dim t as string = "testlabel" & i
convertsomehow(t, label).text = "mytext"
next

so that this would change testlabel1, testlabel2, testlabel3, ... , testlabel50.

View 2 Replies

VS 2008 - Take A String Of Variables With A Common Delimiter And Break It All Back Out Into Separate Variables

Dec 11, 2011

Last year (2010) I came across a FANTASTIC command that allowed me to take a string of variables with a common delimiter and break it all back out into separate variables (possibly an array) with one statement.

[Code]...

As long as the delimiter was a unique specifiable character, this one-statement command could break it out into elements. my memory and point me in the right direction.

View 2 Replies

Forms :: Passing Variables Between Forms

Nov 27, 2009

I seem to be running into an issue. This may seem like a noob question (which it really is, I only have experience in vb6 from years ago) but what Im trying to do is pass a variable from one form to another. Ive tried telling the first form to set the value of the variable on the second form like so frmsecond.variable = "value" but that does not work. Ive tried placing a public variable in a module to do it, but again, no luck. The only way seem to be able to get it to work is the second form setting the variable by reading the value from the first form like so [code]The problem I have with that code is what if for some reason the selected line gets changed as the form is loading or something to that nature. It doesnt seem very secure.

View 5 Replies

Forms :: Variables That Can Be Accessed By All Forms?

Aug 29, 2009

i am writing an application that will require users to provide login details. After the user has logd in a second form will be shown. Allowing the user to change his/her own details. What i have a problem is, im not able to pass the variables, containing username and password in the login form to the second form. Ive tried declaring the variables as Public but when the login form closes the variable are reset to zero.

View 7 Replies

VS 2008 - How To Refer To Objects Via String

May 9, 2011

I have lots of labels that I need to refer to.
E.g. label1 = listbox1.selecteditem.tostring & "123"
label2 = listbox1.selecteditem.tostring & "123"

I have 20 labels which i need to repeat the same process for. What I found was this code which always gives me the null reference error.
CType(Me.Controls("Label" & i), Label).Text = "what i want here"

I have stated dim i as integer = 1
And later i = i + 1 until it is 20.

I've tried i.tostring and cstr(i) when referring to it but it keeps saying it doesn't exists even though i have labels 1 to 20 named label1, label2 etc. on my Form.

View 9 Replies

VS 2008 Exactly Does The Margin Refer To When Printing?

Apr 20, 2009

I've built an app, that draws text to four rectangles on a pre-printed page with a design, I'm wondering what the margin refers to?

Also our printer doesn't print all the way to the edge, there's a white border, about the height of this little guy:If I printed from a printer that prints to the edge, will the text be in the same position as it would be if it was printed with the border around it, the text should be in the exact same position right?

View 2 Replies

VS 2008 Use A Variable To Refer To A Control By Name?

Jan 9, 2010

If I have a TextBox control with the Name Property = Textbox1, is there a way to use a variable for part of the name - like this:

Dim i as String = "1"
"TextBox" & i & ".Text" = "Hello"

View 3 Replies

VS 2008 Index And Length Must Refer To A Location Within The String?

Sep 28, 2009

Dim Phone as string = "478-742-4050 478-256-6550"
If _Phone.Length > 25 Then
_Phone = IsNull(ReturnValue.Substring(0, 25).ToString, "")
End If
Return _Phone

Error: "Index and length must refer to a location within the string. Parameter name: length"

View 15 Replies

How To Variables Between Forms

Sep 29, 2010

I'm sure this gets asked a lot, but I can't seem to find an answer for it. I want to have my Form2 change a variable in Form1.

View 9 Replies

Variables From Different Forms

Jan 22, 2012

i need to call upon variables from different forms, in my first form i make a variable called "temp" i then use [code]to open the new form and hide the first, is there a way to access temp ( the variable declared in the first form) in the second form?

View 6 Replies

VS 2008 ArgumentOutOfRangeException - Index And Length Must Refer To A Location Within The String

Jun 23, 2009

I got this error and I don't know what should I do. Index and length must refer to a location within the string. Parameter name: length That's the line that i get the error on:

[Code]...

View 2 Replies

Forms :: Using Variables From One Form In Another?

Aug 11, 2011

I would like to pass variables variables from one form to another but the thing is that there is no variable that is actually being passed. I have tried to use instanciation

Dim f2 as form2
f2=new form2()
f3.textbox1.text="Whatever I want to pass",
but this did not work

View 5 Replies

How To Pass Variables Between Forms

Sep 6, 2009

I am having trouble passing variables between forms. Ive tried many methods but none seem to work. The first method I tried was to dim a public variable on the first form and call it on the second....no success

Form 1:
Public cliCode as string
cliCode = me.tbClientcCode.text

Form 2:
dim clientCode as string = form1.clicode
or

Form 2:
dim clientCode as string

On the Form2 load event....
clientCode = form1.clicode

With method 2 I created some classes on which form 1 loads and form2 access........
Public
Class frmClient
Private db As New ClientDataContext
Public clientInstance As New BusinessLogic.classClient
Public cliCode As String
[Code] .....

View 18 Replies

How To Share Variables Between Forms

Feb 17, 2012

Is it possible to share subscripted variables and their data between forms? So far I can't see the variables I made public in one form, in a second form.

View 5 Replies

Multiple Forms, Variables And So On?

Oct 24, 2011

i would like to say i am a novice programmer, in year 12. I am designing a small game for my HSC and one of my forms is getting very cluttered with controls and code. To resolve this cluttering, i have had the idea to create new forms for some aspects of the game (such as different game modes and so on). However, in order for that to happen i have to drag some variables of the new form to the old form, (these variables would be just booleans or integers to say whether you lost a game or won a game or something that would carry on to the main form.)

[Code]...

View 1 Replies

Pass More Than One Variables Between Forms?

Mar 6, 2010

Code below just allow me to pass only one variable at one time..the code below show how to pass the platelabel to label3..

how can i pass 2 variable in the same time..[code]...

View 5 Replies

Pass Variables Between Forms?

Nov 10, 2011

I know this should be easy but I'm either having a brain fart or I'm just more inept than I thought; probably a combination of the two.

Passing a value to a form on startup is a piece of cake, but I don't think I've ever had to do the following before in all my ooooh, 8 months of programming:

I have a main form with a button and a textbox. The button opens another form with a datagridview. What I want to do is pass the selected value from the DGV back to the textbox on the first form.[code]...

View 8 Replies

Passing Variables Between Forms?

May 17, 2012

I have a Form1, the user types a "Client ID" in a textbox if it's not a valid one, it opens a Form2 in which the user selects the correct "Client ID", once selected he presses an OK button. And there comes the porblem.. it opens a new Form1 with the Client ID that he selected from Form2, but I still have the first Form1 opened.
I have two Form1 opened...

I which to keep the original Form1, but with the value sent from Form2..

I'm using this code:

Code in Form1
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code].....

View 2 Replies

Share Variables With Other Forms?

Mar 6, 2010

Say I have public string variable called "_Test" on Form1, how can I allow Form2 to edit/read the variable from that form? I tried putting this on Form2:

Public _Test as String = Form1._Test

But if I start Form2 without Form1 being open, it gives me an exception.

View 4 Replies

Sharing Variables Between Forms?

Jun 16, 2010

i've almost completed my Yahtzee game except for the high scores function. I've got everything worked out except how to take the highscore variable from Form1, and share the data with Form 2

View 12 Replies

VB 10 Passing Variables Between Forms?

Apr 12, 2011

I am working on a program, and I would like to have the program pass a name from on form to another.

This is my code :
form 1 :
Public Class Form1

[code].....

View 8 Replies

VS 2008 Error Message: Index And Length Must Refer To A Location Within The String

Oct 15, 2010

I'm working on a vb.net project, when I execute the project I get the following error message: "error message: index and length must refer to a location within the string"

Public Sub New(ByVal lineIn As String)
parent = Trim(lineIn.Substring(0, colStarts(1)))
enfant = Trim(lineIn.Substring(colStarts(1), colStarts(2) - colStarts(1)))
des_F = Trim(lineIn.Substring(colStarts(2), colStarts(3) - colStarts(2)))

[Code]...

I get the error msg in the line marked bold. When i checked the input file, the length of all the fields looks fine. I dont understand the cause of this error.

View 5 Replies

VS 2008 Set Size - Error 1 'Bisacody.Form1' Cannot Refer To Itself Through Its Default Instance

May 13, 2009

How i can set size?

[Code]...

View 2 Replies

Adding Integer Variables From Two Different Forms?

Apr 18, 2012

I am saving scores form my game in to a dadt base but the game involves answering questions mid game that pop up in a seperate for so I have two scores a question score and a game score and at game over i want the two scores to add up and be displayed in one labe wich appers on the game form when my count down hits 0 so I tryed to add them

heres is the game code

Public Class frmplay
Dim score As Integer
Dim total_score As Integer

[Code].....

so I want to add correct answer to score and display it in a label thatwill show on my game form

View 4 Replies

Best Practice For Sharing Variables Across Forms?

Mar 27, 2011

I need to share variables across two forms in vb.net. One of them is the main form and the other is a child form.

Create a static/shared variable in one of the forms and access it in the other forms via:
Form1 frm = new Form1(); //creating object of parent to access shared variable
frm.a = "abc"; // passing value

Send an instance of the main form to the child form when creating the child form. The variables can then be accessed via a property function. Create global variables in a module. This seems like the easiest option, but I doubt it is the best option.I also read something about delegates and events, but I don't know how to implement this.

View 4 Replies

Forms :: Declaring Module Variables?

Feb 11, 2009

I am new to the forum and new to the visual studio set up and have been working at a practical at home and have ran into some difficulty. The notes say that I am to declare several module variables below the section entitledI have the rest of the form complete but have been unable to locate where I am to place this code

View 1 Replies

Forms :: Operate Variables From String?

Jun 8, 2009

If I typed in "Dim X as Integer" in a text box, I figured that I could just use If TextBox1.contains to make vb.net dim it. However, how would, if I typed "X = 3y * 9" in the text box, actually calculate that and print it in another text box?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved