PC Review


Reply
Thread Tools Rate Thread

How to access a control in another form

 
 
Carlos
Guest
Posts: n/a
 
      15th Jul 2004
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


 
Reply With Quote
 
 
 
 
William Ryan eMVP
Guest
Posts: n/a
 
      15th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Carlos
Guest
Posts: n/a
 
      15th Jul 2004
Excuse my ignorance,
how can you do that ?

Thanks
"William Ryan eMVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
a
Guest
Posts: n/a
 
      15th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Excuse my ignorance,
> how can you do that ?
>
> Thanks
> "William Ryan eMVP" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      15th Jul 2004
* "Carlos" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2003 file in Access 2007: Simple form control crimsonisland Microsoft Access Forms 1 28th May 2009 02:01 AM
How do you access a control property of a main form from a custom user control? forest demon Microsoft C# .NET 6 22nd Aug 2007 11:36 PM
access form control propertys via control name as string Peted Microsoft C# .NET 3 22nd May 2007 10:13 AM
refer to a control on another form in access as a control source =?Utf-8?B?dGhlQnJ1Y2VHdXk=?= Microsoft Access Form Coding 7 21st Feb 2007 07:35 PM
Is it possible to access a control in another form? Doru Roman Microsoft C# .NET 10 3rd Feb 2006 07:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:14 PM.