Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there any way to make a global string?

i want to have 2 forms, and in Form2 the user will type some text into a textbox, and then when they click an OK button, it will add this text to a string which will then be usable in Form1

Page Edit 2.0 Alpha 2 OUT NOW!

- Download Now -

  • *Experts*
Posted (edited)

To setup a global variable in Form1 declare a variable Public Shared...Public Shared myVaiable As String. Then from Form2 use Form1.myVaiable = "my string".

 

And try http://testing123.info/threads/93824/ for configuring a delegate for your Button1.Click.

 

However.....

 

In most opinions it is better to add a new class to your project and use a public properity to store the variable.

 

There is a post "Global Variables" on this site that goes into more detail why this is a better approach.

Edited by DiverDan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...