Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 3rd, 2003, 04:33 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old November 4th, 2003, 06:00 PM
Authorized User
 
Join Date: Oct 2003
Location: , , New Zealand.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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()
        MainForm.ShowDialog()
    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
Form1.ActiveForm.Dispose()
Form2 = New Form2()
Form2.ShowDialog()

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

TextBox2.Text = myText

Reply With Quote
  #3 (permalink)  
Old November 9th, 2003, 06:58 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 04:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.