473,387 Members | 1,528 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,387 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 2390
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.