Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

Changing property of an object from a modal form.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rhaazy - 19 Jul 2006 19:22 GMT
using C# VS2003

private void frmMDIMain_Load(object sender, System.EventArgs e)
        {
            Form frmLogin = new frmLogin();
            frmLogin.ShowDialog();

        }

private void frmLogin_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
        {
            frmMDIMain.panel5.Visible = true;
            frmMDIMain.button1.Visible = true;
            frmMDIMain.panel6.Visible = true;
            frmMDIMain.dataGrid1.Visible = true;
        }

How do I make the code in frmLogin_Closing work?  I made the objects
public but the compiler still tells me I have to create an object
reference...  There must be something I'm missing any help would be
great.
Brian Richards - 19 Jul 2006 21:26 GMT
You need to do something like:

private void frmMDIMain_Load(object sender, System.EventArgs e)
{
   Form frmLogin = new frmLogin();
   frmLogin.Closing += new
System.ComponentModel.CancelEventHandler(this.frmLogin_Closing);
   frmLogin.ShowDialog();
}

private void frmLogin_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
    panel5.Visible = true;
    button1.Visible = true;
    panel6.Visible = true;
    dataGrid1.Visible = true;
}

frmLogin.Closing += new ClosingHan
> using C# VS2003
>
[quoted text clipped - 18 lines]
> reference...  There must be something I'm missing any help would be
> great.
rhaazy - 20 Jul 2006 13:36 GMT
I have no idea whats going on here.  If you could explain a bit more
how this is going to help me with my problem maybe I can get it
working.  Making chose changes doesn't get me any closer, if anything
the compiler just throws more errors..
> You need to do something like:
>
[quoted text clipped - 38 lines]
> > reference...  There must be something I'm missing any help would be
> > great.
Pritcham - 21 Jul 2006 08:59 GMT
Hi

I'm assuming that the code you originally listed in your post was from
the 2 forms (i.e. the 'private void frmMDIMain_Load' sub was in your
frmMDIMain's code, and the 'private void frmLogin_Closing' code was in
your frmLogin code?

The above poster basically 'moved' the code from frmLogin into your
frmMDIMain form and added an event listener which responds to the
frmLogin closing event and fires the sub accordingly.  This way you're
not having to reference the main form from your login form.  Hope that
makes sense.

Martin

> I have no idea whats going on here.  If you could explain a bit more
> how this is going to help me with my problem maybe I can get it
[quoted text clipped - 42 lines]
> > > reference...  There must be something I'm missing any help would be
> > > great.
rhaazy - 21 Jul 2006 13:37 GMT
Hey I got it now, thanks a lot!

> Hi
>
[quoted text clipped - 10 lines]
>
> Martin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.