PDA

Click to See Complete Forum and Search --> : Master WindowS Form for Windows App


Winla
Jun 6th, 2006, 05:57 PM
Find a lot talking about MasterPage for ASP.NET, but Couldn't find a sample master winform for business app.

I am looking for something like this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MyNS
{
public partial class frmCommon : Form
{
private Form _CallingForm;
private string _CallingRole;
private string _UserRole;


public Form CallingForm
{
get { return _CallingForm;}
set { _CallingForm =value;}

}
public string CallingRole
{
get {return _CallingRole;}
set {_CallingRole =value ;}

}
public string UserRole
{
get { return _UserRole; }
set { _UserRole = value; }
}

public frmCommon()
{
InitializeComponent();
}

public frmCommon(Form callingform, string callingrole, string userrole)
{
_CallingRole = callingrole;
_CallingForm = callingform;
_UserRole = userrole;

InitializeComponent();
}

public virtual void FormFormat{}
public virtual Bool FormValid { }
public virtual Bool FormClean { }
public virtual Bool FormSave { }
public virtual bool FormLoad { }

}
}


looking for professional code sample in c#, thanks

ComputerJy
Jun 6th, 2006, 06:27 PM
Are you talking about MDI Apps?
because there is no such thing as "Master Form"

Winla
Jun 6th, 2006, 06:33 PM
no. I am talking about abstract Master win form which will be be inherited by all other windows forms. This will force coding in all forms with same override methods and variables(standardize coding logic).

popskie
Jun 6th, 2006, 08:33 PM
Master page is release for asp.net 2005.

jmcilhinney
Jun 6th, 2006, 08:41 PM
There is no specific feature in Windows Forms to do this. If you want all your forms to inherit specific properties you should define your own class that inherits Form and is declared abstract. You then derive all the forms in your app from that class instead of from Form. Having said that, I'm not 100% sure that the IDE won't override some of your properties when the form is added to the project because it likes to set some default values. Only one way to find out though.