yet another newbie question!


Mar 7, 2005
Programming Experience
question on strings and forms

I have a textbox on 'form4' in which a web address is typed with an 'ok' button under it. When 'ok' is clicked the address is stored as a string:

Dim strHomepage As String
strHomepage = txthomepage.text

On 'form1' there is a button which, when clicked, I would like to navigate the axwebbrowser(also on 'form1') to strHomepage.
I have delcared 'strHomepage' as being public and have the following code in the click event of the button on 'form1':
I get no errors but it does not work. Been staring at this for so long that I'm probably missing something obvious.
Any help greatly appreciated!!
Last edited:
having had another look at it, i think its something to do with not being able to declare a public variable in an event procedure (the 'ok' button click event)how do i make the string that is initialised in an event procedure visible to the other forms???
Is your strHomepage correct? If i understand it correct, you want to give strHomepage a value in Form4 and then use it in Form1 right?
Then you just have to put your strHomepage public shared in your Form1 so,
Public Shared strHomepage As String

When you want to set a value then in form4, you just have to do
Form1.strHomepage = TextBox1.Text

and normally it should work in your Form1.

I hope this solves your problem.

i'd add a module to the project and in the module declare a homepage variable:

Friend gstrHomePage as String

that string is public to all the forms in the solution