Solved

Determining Sending Form

Posted on 2006-11-27
2
189 Views
Last Modified: 2010-04-16
I have a form [frmNotes] that is called via different forms in my Windows Application.  Depending on which form calls it, I want the title of frmNotes to change and also I have a few different controls that I want to set as visible depending on the form which called it. For example:

if frmMain calls frmNotes:
    frmNotes.Text = "General Notes"
    button1.Visible = True

if frmSub calls frmNotes:
   frmNotes.Text = "Sub Notes"
   button2.Visible = True

I am not sure how to determine which form has called the frmNotes.

Thanks for the help.
0
Comment
Question by:sneeri_c
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 150 total points
ID: 18022138
In your form create an overload for for the Show() method that takes a form as an argument.

public void Show(Form caller){
    //check who the caller is and set you text and button visibility accordingly
    // then call show.
    this.Show();
}
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 18022146
Or create a constructor that does the same thing...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question