need help transfering data between forms

C

Chris S

I'm relatively new to VB.NET and have what's probably a very simple
question. I'm trying to get one form to access (view and modify) data on
another form. For example, the startup object is a form called "FormA".
This form contains a string called "ImAString." FormA then opens FormB.
How can FormB read from/write to "ImAString"?

Thanks for your help,
Chris S.
 
I

IbrahimMalluf

Hello Chris

In formB, modify the constructor this way:



Public Sub New(myString as String)

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

me._myString = myString

End Sub

Private _myString as String

Then when calling formB from formA do this:

Dim Myform as New FormB(StringValue)

--
Ibrahim Malluf
http://www.malluf.com
==============================================
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
==============================================
Pocket PC Return On Investment Calculator
Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx
 
C

Cor

Hi Chris,

Better than try to get the information is to suply the information to formB
When it is a dialogform you are making (it sounds a little to that)
\\\formA
dim frm as formB
frm.mystring = mystring
frm.showdialog
///
\\\formA
beneath the form designer code
public mystring as string
(or a real property)
///

I hope this helps
Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top