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

winforms control question

In a Windows app, how do you make reference to a control on another
form? I am entering the name of the form, but none of the controls
appear in Intellisense.

*** Sent via Developersdex http://www.developersdex.com ***
Mar 19 '07 #1
4 1359
By default, controls have protected accessibility (VB has Friend). One
option is to change this to public, or create a public property that let's
you access the control or individual properties.

--
Carsten Thomsen
Senior .NET Solutions Architect / Developer / Author
MCAD/MCSD/MCSE/MCTS
"Mike P" <mi*******@gmail.comwrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
In a Windows app, how do you make reference to a control on another
form? I am entering the name of the form, but none of the controls
appear in Intellisense.

*** Sent via Developersdex http://www.developersdex.com ***

Mar 19 '07 #2
You might find that the constituent controls are private by default. Try
changing the modifier to Internal.

Hope that helps.

"Mike P" wrote:
In a Windows app, how do you make reference to a control on another
form? I am entering the name of the form, but none of the controls
appear in Intellisense.

*** Sent via Developersdex http://www.developersdex.com ***
Mar 19 '07 #3
I've made both the declaration of the control public, and the click
event public, but it still doesn't appear in Intellisense on the other
form..?

*** Sent via Developersdex http://www.developersdex.com ***
Mar 19 '07 #4
Are you creating an instance of the other form? If you add a TextBox to the
second form and call it txtTest, then set the modifier to Internal, you
should be able to access it as follows:

Form2 f = new Form2();
f.txtTest.Text = "Hello";
f.ShowDialog();
MessageBox.Show(f.txtTest.Text);

This lets you both set and get the value in the TextBox on the second form.

"Mike P" wrote:
In a Windows app, how do you make reference to a control on another
form? I am entering the name of the form, but none of the controls
appear in Intellisense.

*** Sent via Developersdex http://www.developersdex.com ***
Mar 19 '07 #5

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

Similar topics

1
by: Steve Floyd | last post by:
This is a WinForms question. In the VB6 world, you could easily reference a control by name, e.g., if I want to make the check box named chkFlag visible, I would do this: frmMain.chkFlag.Visible =...
2
by: David Adams | last post by:
Hi, I am afraid I am asking a very basic question, or just something that is not possible. I have a WinForm app that contains a Form (Form A), and then 20-30 UserControls/WinForms that are...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
0
by: sean | last post by:
From a parent process, I created a custom windows station and desktop. I then CreateProcess using that new station/desktop. There are no problems launching a plain windows app with this...
5
by: Dan Smith | last post by:
Right now the only way to use a WinForms control in MFC is to enable COM Interop for the control and use it in MFC as you would any ActiveX control. While this works, COM Interop is a pain, and an...
2
by: Kurt Denhoff | last post by:
I have an odbc connection on a Winforms UserControl when used within a WinForms project it works fine but when I use it on an aspx page the object doesn't show. The IIS log indicates code...
3
by: Tom S. | last post by:
VS.Net 2003 V 7.1.3088 ..Net Framework V 1.1.4322 SP1 WinXP SP2 I have a WinForms project that I'm having trouble with. I have a custom user control ( all code based, no visual ) and another...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
2
by: Mark Rae | last post by:
Hi, Just looking for some v2 guidance here... In WebForms, the DropDownList control has an Items collection which contains ListItem objects which, in turn, very conveniently contain a text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.