Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 3rd, 2003, 05:33 PM
Registered User
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie question

Hello I em new in VB NET.
I have problem with this. Can someone explain to my how to:
I have Form1 and Form2. Form1 has TextBox1 and Button (for opening Form2) and Form2 with TextBox2. How to remember text in TextBox1 and when I open Form2 that text display in TextBox2.
It is so simple i think, I can`t find any tutorials or example how to do it.
Thanks in advanced.
Old November 4th, 2003, 07:00 PM
Authorized User
Join Date: Oct 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts

I am also new to VB.NET and came across a similar problem. I don't know how good this code is; hopefully someone who knows what they are talking about can verify this, but it seems to work so here goes!

I created a module and adjusted the properties so the project opened with this module. In the module, I added a public variable which contains ("remembers") the contents of the textbox(s). I also included some lines to open the first form:

Module Module1
    Dim MainForm As Form1
    Public myText As String
    Public Sub Main()
        MainForm = New Form1()
    End Sub
End Module

In Form1 I added:

Private WithEvents Form2 As Form

And then a button control that stores the contents of the textbox, closes Form1 and opens Form2:

myText = TextBox1.Text
Form2 = New Form2()

And on Form2, to the Form2_Load event I simply added:

TextBox2.Text = myText

Old November 9th, 2003, 07:58 AM
Registered User
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks Nick.Net
I have some problem with modem so I was anabled to answer you. I look your message and litle testing . Problem in my case is in line that close from1 and open form2. I delete this and everything works great.

Cheers Beginner

Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question pbb Ajax 0 September 26th, 2006 05:47 AM
Newbie question savoym JSP Basics 1 August 16th, 2006 03:15 AM
Newbie Question - Sorry! KP Crystal Reports 1 June 13th, 2006 02:45 AM
C# Newbie Question jazzcatone ASP.NET 2.0 Basics 1 May 25th, 2006 10:18 PM
Newbie question maccer88 Access 1 October 18th, 2003 05:53 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.