473,473 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to access a control in another form

In VB6 I was able to accessa control like a progressbar form a different
form, for example

frm1.progressbar1.value =XXX

but now how can I do that in VB.NET

Thanks
Nov 20 '05 #1
4 13923
Create a public property on the second form that references the control
value - then you can juse reference it as Form2.WhateverProperty

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Carlos" <cp@swa.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
In VB6 I was able to accessa control like a progressbar form a different
form, for example

frm1.progressbar1.value =XXX

but now how can I do that in VB.NET

Thanks

Nov 20 '05 #2
Excuse my ignorance,
how can you do that ?

Thanks
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
Create a public property on the second form that references the control
value - then you can juse reference it as Form2.WhateverProperty

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Carlos" <cp@swa.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
In VB6 I was able to accessa control like a progressbar form a different
form, for example

frm1.progressbar1.value =XXX

but now how can I do that in VB.NET

Thanks


Nov 20 '05 #3
a
There is not an 'automatic form collection' in VB.NET.

If the Progress Bar is on Form1, then when you open Form2, it needs to have
a way of finding the Open version of Form1. Just referring to Form1 does
not get a reference to the Open Form1, just to the Form1 class. (You could
have 20 open Form1's in your app)

So, Form2 would have a variable that refers to the open Form1:

Public frmWithProgressBar as Form1
Then to open Form2, Form1 would do:

Dim f as new Form2
f.frmWithProgressBar = Me
f.show
Then Form2 would reference the ProgressBar on the Form1 that opened it as:

me.frmWithProgressBar.NameOfTheProgressBarOnForm1

You could do a property on Form2, but the Public Variable is easier to begin
with.

Kevin
"Carlos" <cp@swa.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Excuse my ignorance,
how can you do that ?

Thanks
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
Create a public property on the second form that references the control
value - then you can juse reference it as Form2.WhateverProperty

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Carlos" <cp@swa.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
In VB6 I was able to accessa control like a progressbar form a different form, for example

frm1.progressbar1.value =XXX

but now how can I do that in VB.NET

Thanks



Nov 20 '05 #4
* "Carlos" <cp@swa.com> scripsit:
In VB6 I was able to accessa control like a progressbar form a different
form, for example

frm1.progressbar1.value =XXX


If 'frm1' is the app's main form, then you can use the approach
described here:

<URL:http://dotnet.mvps.org/dotnet/faqs/downloads/accessmainform.txt>

If the 2nd form is a dialog that is shown from within the main form or
the form containing the progressbar, add a property to the 2nd form and
assign the progressbar to it after instantiating the 2nd form. Then you
will be able to access the progressbar from within the 2nd form.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

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

Similar topics

14
by: JK Peck | last post by:
I have a fairly large Access application that ran correctly in Access 2000. After upgrading to Access 2003 (and recompiling and updating references), it reliably crashes at a certain point. If I...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
3
by: Michael Ramey | last post by:
How can controls on a Windows Form be accessed (or referenced) from another Class? I know how to do it from another Form. The following doesn't work even though the Control Modifiers property is...
2
by: authorking | last post by:
How to access a control in another form and how to make a form become a MDI container.
4
by: JimC | last post by:
On my main form in a C# program, I create an instance of another form that contains a ListView control, in the usual way, that is: public class frmMain : System.Windows.Forms.Form { // ...
10
by: Les Desser | last post by:
In article <fcebdacd-2bd8-4d07-93a8-8b69d3452f3e@s50g2000hsb.googlegroups.com>, The Frog <Mr.Frog.to.you@googlemail.comMon, 14 Apr 2008 00:45:10 writes Thank you for that. It was very...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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
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...
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,...
1
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...
0
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...
0
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...
0
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...

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.