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

Updating form controls from another class?

ORC
Hi,

I have an application that has 7 forms. I would like to update the controls
on the forms from a single class. How should I do that if possible? The
reason for this is that my application is made for both full- and compact
framework and all the code except the forms is the same.

Thanks
Ole
Nov 16 '05 #1
2 2385
Ole,

I would think that you just pass a reference to each of the forms to the
class. Unless you derive all the forms from a base class which helps to
define the user interface elements in a more coherent manner, you will have
to access the controls through the Controls collection.

Or is there something I'm missing?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ORC" <or*@sol.dk> wrote in message
news:ey**************@TK2MSFTNGP14.phx.gbl...
Hi,

I have an application that has 7 forms. I would like to update the
controls
on the forms from a single class. How should I do that if possible? The
reason for this is that my application is made for both full- and compact
framework and all the code except the forms is the same.

Thanks
Ole

Nov 16 '05 #2
I am having the same sort of issue:

I have set up a class that handles my TcpClient communications. I pass it a
reference to a Label. I then want to dynamically update this Label with
status information. Nothing happens. I have tried all sorts of calls to cause
the Label to “redraw” to no avail. Here is a little snippet:

char[] seps = {' '};
string[] values = response.Split(seps);
retval.Add(values[0]);
extLbl.Select();
extLbl.Focus();
extLbl.Text=values[0];
extLbl.Update();
extLbl.BringToFront();
newsgroupForm.Update();
bval=extLbl.InvokeRequired;
bval=extLbl.IsAccessible;
extLbl.Invalidate();
extLbl.Refresh();
Needless to say, I have thrown everything in except the kitchen sink, and
the Label still refuses to update.

So what do I do now???

"Nicholas Paldino [.NET/C# MVP]" wrote:
Ole,

I would think that you just pass a reference to each of the forms to the
class. Unless you derive all the forms from a base class which helps to
define the user interface elements in a more coherent manner, you will have
to access the controls through the Controls collection.

Or is there something I'm missing?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ORC" <or*@sol.dk> wrote in message
news:ey**************@TK2MSFTNGP14.phx.gbl...
Hi,

I have an application that has 7 forms. I would like to update the
controls
on the forms from a single class. How should I do that if possible? The
reason for this is that my application is made for both full- and compact
framework and all the code except the forms is the same.

Thanks
Ole


Nov 16 '05 #3

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

Similar topics

3
by: MLH | last post by:
I have a form, bound to a query. Its RecordSource property is a query named frmEnterLienAmounts. The form has a few bound controls and some unbound controls. The unbound controls are calculated...
1
by: Hector Martinez | last post by:
I need to send to update a windows control from another class, how can I do that... Thanks in advantage...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
4
by: Bugs | last post by:
Hi, I wonder if anyone can help me out. I'm building a vb.net application that has a form with a panel that contains several other sub forms (as a collection of controls). What I'm wanting to...
3
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
2
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...
14
by: Adam Sandler | last post by:
I have a class with a method which returns a panel. The panel was not created with the visual editor, I coded it by hand -- because some of the content on the panel can be dynamic and thus I chose...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.