Click here to Skip to main content
15,888,325 members
Home / Discussions / C#
   

C#

 
GeneralRe: ActiveX and C# Pin
Mazdak14-Sep-03 4:14
Mazdak14-Sep-03 4:14 
QuestionLet property builder generate code? Pin
Johan de Koning14-Sep-03 1:22
Johan de Koning14-Sep-03 1:22 
GeneralHTML editor in C# Pin
Jasper4C#13-Sep-03 22:24
Jasper4C#13-Sep-03 22:24 
GeneralRe: HTML editor in C# Pin
James T. Johnson15-Sep-03 4:26
James T. Johnson15-Sep-03 4:26 
GeneralRe: HTML editor in C# Pin
Jasper4C#15-Sep-03 8:08
Jasper4C#15-Sep-03 8:08 
GeneralMain Form Control Pin
dbetting13-Sep-03 14:17
dbetting13-Sep-03 14:17 
GeneralRe: Main Form Control Pin
mcgahanfl14-Sep-03 14:15
mcgahanfl14-Sep-03 14:15 
GeneralRe: Main Form Control Pin
dbetting14-Sep-03 15:12
dbetting14-Sep-03 15:12 
For a simple test of visibility and the concept: Given a main form (frmMain) with a panel (pnlMain), using the following:
public class frmMain : System.Windows.Forms.Form<br />
{<br />
  ...<br />
  public ucForm1 UCForm1 = new ucForm1();<br />
  public ucForm2 UCForm2 = new ucForm2();<br />
  ...  <br />
  public frmMain()<br />
  {<br />
    InitializeComponent();<br />
    UCForm1.Parent = this.pnlMain;<br />
    UCForm1.Visible = true;<br />
  }<br />
<br />
  public void ShowUCForm2()<br />
  {<br />
    UCForm1.Visible = false;<br />
    UCForm1.Parent = null;<br />
    UCForm2.Parent = this.pnlMain;<br />
    UCForm2.Visible = true;<br />
  }<br />
}

then given a User Control with a single button (btnViewOtherForm) using the following:
public class ucForm1 : System.Windows.Forms.UserControl<br />
{<br />
  ...<br />
  private void btnViewOtherForm_Click(object sender, System.EventArgs e)<br />
  {    <br />
    Form frmParent = (frmMain) this.Parent;<br />
    frmParent.ShowUCForm1();<br />
  }<br />
}

ucForm2 can be blank. I tried the suggestion, but the reference to ShowUCForm2 cannot be found. I cannot use the loop because the compiler wants to find the reference before it allows it to be used. I've tried several flavors of trying to access the parent, but obviously not the correct one yet. Sigh | :sigh:

In this case, the parent should be two levels up. ucForm1.Parent should be pnlMain whose parent should be frmMain.

Thanks

Dan
GeneralRe: Main Form Control Pin
mcgahanfl15-Sep-03 3:03
mcgahanfl15-Sep-03 3:03 
GeneralScreen Coordinates Pin
Paul Silvernail13-Sep-03 7:32
Paul Silvernail13-Sep-03 7:32 
GeneralRe: Screen Coordinates Pin
leppie13-Sep-03 8:12
leppie13-Sep-03 8:12 
GeneralRe: Screen Coordinates Pin
Paul Silvernail13-Sep-03 8:25
Paul Silvernail13-Sep-03 8:25 
GeneralRe: Screen Coordinates Pin
leppie13-Sep-03 8:40
leppie13-Sep-03 8:40 
GeneralRe: Decimal to Binary to Hex convert Pin
eggie513-Sep-03 18:05
eggie513-Sep-03 18:05 
GeneralNamespace 'ADO' not accessible.... Pin
Pranoti13-Sep-03 5:30
Pranoti13-Sep-03 5:30 
GeneralRe: Namespace 'ADO' not accessible.... Pin
dbetting13-Sep-03 15:17
dbetting13-Sep-03 15:17 
GeneralRe: Namespace 'ADO' not accessible.... Pin
Pranoti14-Sep-03 23:18
Pranoti14-Sep-03 23:18 
GeneralRe: Namespace 'ADO' not accessible.... Pin
dbetting15-Sep-03 14:27
dbetting15-Sep-03 14:27 
GeneralUsing a custom icon from resource file Pin
Paul Silvernail13-Sep-03 4:24
Paul Silvernail13-Sep-03 4:24 
GeneralRe: Using a custom icon from resource file Pin
Paul Silvernail13-Sep-03 7:30
Paul Silvernail13-Sep-03 7:30 
GeneralRe: Using a custom icon from resource file Pin
James T. Johnson14-Sep-03 11:10
James T. Johnson14-Sep-03 11:10 
GeneralFast image adding for ImageList Pin
Jucovschi Petru13-Sep-03 3:55
Jucovschi Petru13-Sep-03 3:55 
GeneralRe: Fast image adding for ImageList Pin
leppie13-Sep-03 4:57
leppie13-Sep-03 4:57 
Generaldebugging in VS stopped working... Pin
Jan R Hansen13-Sep-03 1:19
Jan R Hansen13-Sep-03 1:19 
GeneralRe: debugging in VS stopped working... Pin
Uwe Keim13-Sep-03 2:26
sitebuilderUwe Keim13-Sep-03 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.