473,769 Members | 6,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Communicating Between 2 Forms..

hello again, i have another question... i am writing a program with 2
windows forms...

first form have a search button and several text buttons to list the data
loaded from an sql database

second form just have a listbox that shows the search results in the
listbox..
i want to let user select from the second form's listbox and show the
results from the first form. how can i "post" te selected items name to the
first form without creating another form? the only way i find is like this:

first form:

public void listitems(strin g selecteditem)
{
dataview.rowfil ter = "username = '" +selecteditem +"'";
}

and in the second form:

private void listBox1_Double Click(object sender, System.EventArg s e)

{

Form1 f = new Form1();

f.list(listBox1 .SelectedItem.T oString());

f.Show();

}

but that makes my program show several "form1" ' s in my program and thats
something i really dont want to happen.. so is there a way to "post"
variables between forms like asp.net do?

p.s: i cant write replies from outlook express. so i thank you from here
for spending your time to respond and helping. have a good day.
Nov 16 '05 #1
1 2220
Hi,

Instead of creating public function in form1 create a public function in
form2. When user selects the value from the list box in the 2nd form just
hide the form2 and than call that public function from form1 and dispose the
second form(if needed)

I think this would help :)


"Serdar C." <se*****@intera ktif.gen.tr> wrote in message
news:ef******** ******@TK2MSFTN GP12.phx.gbl...
hello again, i have another question... i am writing a program with 2
windows forms...

first form have a search button and several text buttons to list the data
loaded from an sql database

second form just have a listbox that shows the search results in the
listbox..
i want to let user select from the second form's listbox and show the
results from the first form. how can i "post" te selected items name to the first form without creating another form? the only way i find is like this:
first form:

public void listitems(strin g selecteditem)
{
dataview.rowfil ter = "username = '" +selecteditem +"'";
}

and in the second form:

private void listBox1_Double Click(object sender, System.EventArg s e)

{

Form1 f = new Form1();

f.list(listBox1 .SelectedItem.T oString());

f.Show();

}

but that makes my program show several "form1" ' s in my program and thats
something i really dont want to happen.. so is there a way to "post"
variables between forms like asp.net do?

p.s: i cant write replies from outlook express. so i thank you from here
for spending your time to respond and helping. have a good day.

Nov 16 '05 #2

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

Similar topics

1
2863
by: Martin | last post by:
This is probably a very easy one but I just can't put my finger on the communicating events name:- I have a MDIform with a couple of child forms. The child forms scroll vertically at run time using the automatically supplied scrollbars of the MDIform. When scrolling , or immediately after scrolling, the child forms I want a procedure to be called. How do I do this??. I have tried the MDIform_MouseUp event and this works correctly when...
13
4295
by: Craig | last post by:
Hey all, Here's the situation: - two websites, one on domain1 and the other on domain2 - domain1 opens a new window which is a javascript app from domain2 - domain1 needs to communicate with the javascript app on domain2 The problem occurs in that last step. Browsers don't allow script access across domains for security reasons, rightly so. Nonetheless, I still
4
1215
by: ReMEn | last post by:
How can I call a function located in Form1 while in the scope of Form2? I've tried Form1.MyFunction() but I get a compile errors. Any ideas? Thanks.
3
23879
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have converted the mdb to version 2002 under MS Access XP Polish and under this version everything works OK. The problem starts when I copy the mdb file to Windows XP EN and start it with MS Access XP EN. I get following error: "The expression On...
1
345
by: Serdar C. | last post by:
hello again, i have another question... i am writing a program with 2 windows forms... first form have a search button and several text buttons to list the data loaded from an sql database second form just have a listbox that shows the search results in the listbox.. i want to let user select from the second form's listbox and show the results from the first form. how can i "post" te selected items name to the
1
1034
by: TGF | last post by:
Hello, I have a little dilemma (At least it is to me). I have two classes, Class A and class B, where Class A contains the UI thread and class B contains another thread. I want to be able to communicate from ClassA to ClassB and then from ClassB to ClassA. The problem comes in with the include files. It seems there is some sort of overlapping where one is not defined when it is supposed to be. This is expected and I cannot seem to...
6
1477
by: AMeador | last post by:
I have a form where a user will check boxes next to items that have been completed. They will click a button on the form to mark the items as completed. When they do this, I will have the 'parent' form instantiate another form where the details of this completed event will be entered. Once the data is entered on this 'child' form, the data entered should be updated/added to the database. The 'child' form also has 'Cancel' and 'Cancel All'...
3
1217
by: Mike Grainger | last post by:
Good Day: I am attempting to reference the value in a dropdownlist in the contents frame from the main frame and use it for filtering od a dataview. I get object is null. Any help on referencing an object in another frame would be greatly appteciated. Mike
6
1054
by: PaulN | last post by:
I need to instantiate a class (Class1) in the startup form (Form1), set some of Class1's properties then open another form (Form2) and have it read Class1's properties and set the remainder of Class1's properties and finally to have Form1 examine Class1 and send changes to a database. I've tried passing Class1 into a property of Form2 and every combination of Friend declaration that I can think of and can't get this to work. I'm not...
2
1177
by: Jasper Jones | last post by:
I have a main form which has a list of items from a table on my database. If I click one of these items it brings up a second form which lets you edit the details for that item. If I change an item's details and then close the edit form I want the main form to update its datagrid by calling the sub I wrote which refreshes the dataset. What is the best method of doing this; I know I can call commands after a showdialog form but I really...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.