473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Winforms Question.

Hi there,

I'm trying to trasfer some data from one form to another. I know I could use
global variables to trasfer the data from one form to another. I know is got
to be another way to do this not involving global variables.

Can anybody give some advices or hints or some ways that I can do this?

Thanks very much.

Manuel

Nov 21 '05 #1
2 925
Thanks Scott,

I thought about inheritance for sure, but as you said is not the prettiest.
My forms are totally different from each other. If I inherit from the first
form, all the controls from the first form will show up on my second form,
not good.

I need need the information from 5 or 6 text boxes to be transffered into my
second form. that's all I need.

Thanks,

Manuel
"Manuel Canas" <mc*****@hotmail.com> wrote in message
news:9HKXc.20095$A8.16705@edtnps89...
Hi there,

I'm trying to trasfer some data from one form to another. I know I could use global variables to trasfer the data from one form to another. I know is got to be another way to do this not involving global variables.

Can anybody give some advices or hints or some ways that I can do this?

Thanks very much.

Manuel

Nov 21 '05 #2
Manuel,

You can share data between forms a few different ways (probably more than
what I'll suggest). First you can use shared variables.

Form1:
Public Shared var1 as String
var1 = txtbox.Text

Form2:
Dim myvar as String
myvar = Form1.var1

Another way you can share data is to pass it to the form through a
constructor.
Form1
Dim form2instance as New Form2(txt1.Text, txt2.Text)
form2Instance.Show()

Form2:

Dim myval1 as String
Dim myval2 as String

Public Sub New(Byval var1, Byval var2)
Mybase.New()
InitializeComponent()
myval1 = var1
myval2 = var2
End Sub

Hope this helps

-Matt

"Manuel Canas" <mc*****@hotmail.com> wrote in message
news:9HKXc.20095$A8.16705@edtnps89...
Hi there,

I'm trying to trasfer some data from one form to another. I know I could
use
global variables to trasfer the data from one form to another. I know is
got
to be another way to do this not involving global variables.

Can anybody give some advices or hints or some ways that I can do this?

Thanks very much.

Manuel

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Spiegel | last post by:
Hey all, I have contusions and I think a minor concussion after trying to find information on advanced WinForms DataGrid use. Does anyone know of a site / book that gets really in-depth on the...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
5
by: Dan Smith | last post by:
Right now the only way to use a WinForms control in MFC is to enable COM Interop for the control and use it in MFC as you would any ActiveX control. While this works, COM Interop is a pain, and an...
20
by: Martin Rosén-Lidholm | last post by:
Although an impossible question to answer, I fell urged to raise it anyhow. Given a fairly complex ERP application scenario, what's your estimation for the X-ratio dev. time for...
1
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
2
by: Mark Rae | last post by:
Hi, Just looking for some v2 guidance here... In WebForms, the DropDownList control has an Items collection which contains ListItem objects which, in turn, very conveniently contain a text...
0
by: netflex | last post by:
Working on a handed off C# project and pretty much my third time dipping into C#. In my solution file, I have a collection of .resx files in their own folder, several .cs files, and my winforms .cs...
0
by: BigDave | last post by:
Hi all, I tried this question in the WinForms forum, but perhaps I'll have better luck here. We have an ASP.NET 2.0 web app which uses Profiles, and want to write a little WinForms app to...
23
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.