473,808 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating UI of another form

Hi all,

as you can see from the level of my question, i am pretty new to c# and
programming in general.

situation: i would like to update the UI of a form (main form of my
application) from a second form (which was called from the first).
Ideally when a button on the second form is pressed, the first one
(main form) should update/refresh its UI.

But it would be also fine to have the first form refreshing when the
second form is closed/disposed.

Can you help me please? Thanks in advance.

Luca

Jun 15 '06 #1
2 1356
<lu*******@gmai l.com> a écrit dans le message de news:
11************* ********@h76g20 00...legro ups.com...

| as you can see from the level of my question, i am pretty new to c# and
| programming in general.
|
| situation: i would like to update the UI of a form (main form of my
| application) from a second form (which was called from the first).
| Ideally when a button on the second form is pressed, the first one
| (main form) should update/refresh its UI.
|
| But it would be also fine to have the first form refreshing when the
| second form is closed/disposed.

Try adding an event to the second form and catching it in a handler on the
first form. Hook up the handler after creating the second form but before
showing it.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Jun 15 '06 #2
Hi,

There are several ways of doing this:

- Pass a reference to the first form in the constroctor of the second. then
you should declare some public methods in Form1 they will do the update on
it, this method will be called from Form2.

- Make Form2 declare some events that Form1 can subscribe to and update its
UI as needed.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<lu*******@gmai l.com> wrote in message
news:11******** *************@h 76g2000cwa.goog legroups.com...
Hi all,

as you can see from the level of my question, i am pretty new to c# and
programming in general.

situation: i would like to update the UI of a form (main form of my
application) from a second form (which was called from the first).
Ideally when a button on the second form is pressed, the first one
(main form) should update/refresh its UI.

But it would be also fine to have the first form refreshing when the
second form is closed/disposed.

Can you help me please? Thanks in advance.

Luca

Jun 15 '06 #3

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

Similar topics

11
16237
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? 1) simply UPDATING the values for all fields in the table, whether or not any particular field has actually changed 2) running a second SELECT statement and comparing the $_POST vars to the returned values, and only UPDATING those that have...
1
1408
by: Joshua Russell | last post by:
Firstly my main method is like this: static void Main(string args) { // New Form Thread FormHandler myFormHandler = new FormHandler(); ThreadStart myThreadStart = new ThreadStart(myFormHandler.ShowForm); Thread formWorkerThread = new Thread(myThreadStart); formWorkerThread.Start();
9
5837
by: Jervin Justin | last post by:
Hi, I've been having this problem for some time with Web Forms: I have a web app that sends data to a service when the user presses a button. Based on the data, the server will send several replies. Since there is no way for a service to post to a client, I am using a thread on the client that polls the server for updates. (Feel free to recommend changes to that as well)
1
1156
by: TGriffith | last post by:
I have a function and OPEN.WINDOW event that occurs when the suer presses a button. I want to set a value in the New Window and upate a value on the parent form. Is this a javascript solution only? If so, does anyone have examples of updating the server side controls or an HTML (extra form)?
9
2534
by: hrreece | last post by:
I have an Access 2002 database that has a form that can be used to review individual records. At the bottom of the form are buttons that are linked to functions that allow the user to "Find a record using search criteria", "Delete the current record" and so on. After a user has used the search criteria to find a specific record, I would like to use the "delete" function on the form to not only delete the record, but also update another table. ...
0
1136
by: adalyc | last post by:
I NEED SOME GUIDENCE WITH UPDATING A COLLECTION OF ITEMS IN A LIST BOX WHEN THE USER CLICKS ON A BUTTON FROM ANOTHER FORM,, i HAVE LISTED THE PROBLEM PARTIALLY. I fIGURED OUT MOST OF THE PROBLEM EXCEPT FOR THE UNDERLINED PART. pLEASE HELP. thIS IS VISUAL BASIC 2005 An airplane has 15 rows (numbered 1 through 15), with six seats (labeled A, B, C, D, E, and F) in each row. . When the agent clicks on one of the text boxes, a second form...
4
2639
by: AlexNunley | last post by:
I've adopted a moderately sized (65k records) active use database (Access 2000, Windows XP). One of the most commonly used forms is whats called the RMA generation field, used to add claim information to a table on an item-by-item basis. the form is pretty straight forward, but is in need of updating. In talking with some of the users its been decided to add a few fields to the form. Digging through the guts, I find commands, the cmdAddParts...
4
1549
by: parkergirl | last post by:
Hello, I am currently working on a project that has many tabs all on one form. Since you can only have so many controls on one form, my job is to seperate these tabs into forms. One problem that I am having is updating text fields with a user's information on another form when double-clicking a MSFlexgrid row. Please help!
2
3324
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the CurrentChanged event of the BindingSource of the combobox to update the textbox. When selecting an item in the combobox or when selecting a row in the grid, it is updating the textbox correctly. The problem is when I apply a filter in the grid, and then...
0
1146
by: Eps | last post by:
Hi, I have a win form and a class library, in the library I do a long running proccess (processing a large number of files), I am planning to do this in another thread. What are my options for updating the progress bar in the win form ?. I would like the class library to be as stand alone as possible, so what is the best way to expose the state of the long running operation and what is the best way for the win form to consume it ?.
0
9600
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
10631
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9196
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
7651
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
6880
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
5548
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...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.