473,408 Members | 2,832 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,408 software developers and data experts.

Pass Parameters between C# Forms !

hi
am using Microsoft Visual C# 2005 as the programming language.
here what i want to do..
when run, its mainly 1 form..(Form1)
with some buttons..
one of them is "Setup the Form" (which change the form appearance or add/remove some controllers in it).
when i click the "Setup the Form" button, i made new instance of a 2nd form (Form2) .. which have some text boxes, and check boxes.

ill ask about the simplest thing (just to get the idea!!).
if i want to change the Form1 text (in title bar)

i enter the new text in a textbox and i click submit.
i want to make it like this in the buttonSubmit_Click function (we still in Form2)

Form1.Text = Form2.TextBox1.Text.ToString().

i get a error msg, which means that this Form (Form2) has no access to Form1 controllers !
is there a way to do that !!!! : (

P.S : i tried to use delegates and events.. but how can i "Fire" the event in Fom2 and handle it in Form1 !?

any 1 have any idea !
thanx in advance..
Jul 9 '07 #1
3 1415
nmsreddi
366 256MB
Hello

Create an object of form one in form two then you can access

form1 properties in form2 ,

try it out ,it works fine
Jul 10 '07 #2
Make a property in form 1 and on Submit button in Form 2 pass the values to that property on form1.
Jul 10 '07 #3
prabunewindia
199 100+
hi friend,
create a constructor for form1

form1(string para1,string para2)
{
string name1=para1;
string name2=para2;
}

now create an object for form2

form1 f1=new form1("aaa","bbb");
f1.open();

thats enough.
u can create multiple constructor for a form as like method overloading
Prabu
Jul 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
3
by: Tim | last post by:
Hi, I am trying to pass a SQL Command, complete with parameters and their values from one form to a modal form. The modal form has; public void...
3
by: Agnes | last post by:
There is a button in form A , as the users click it, Form B will show. however, how can i pass the parameter to form B . the parameters got (tablesname,search condition). As form B receive these...
1
by: Mikey G | last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL database and loads a table into a Dataset, and then displays that table information in a DataGrid on a...
9
by: skinnybloke | last post by:
Hi - I have 3 access queries which I run via 1 macro. Each of the queries now requires 2 parameters when they the run. The parameters are start and end dates. I have built the parameters...
3
by: Pia Stevens | last post by:
For a GUI CSharp program I could define command line parameter as well by declaring them in Main(): static void Main(string args) But how do I pass them easily to Form1 ? Or should I...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
5
by: superleochen | last post by:
When I choose an item with 2 columns in a list box, and press a button, I hope to pass this 2 columns as parameters into a query? e.g. WHERE...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.