开发者

Using Template For Client Forms

My project is a desctop application with client and server side. Maybe later will be even web interface. Users can fill out different types of forms. I want use some kind of templates of this forms (on xml) a开发者_StackOverflow中文版nd put data on client side in this templates subsequently to store user fills out a form in xml.

I'm on the right track?

1.Maybe i can use String Template or there are alternatives?

2.How can I attach a search on only some fields filled in forms, which will be stored in xml?


You can have make a base form and use it as a template for other forms by inheriting it rather than inheriting Form.

Base form:

public partial class BaseForm : Form
{
    public BaseForm()
    {
        InitializeComponent();
    }
    protected virtual void closeButton_Click(object sender, EventArgs e)
    {
        this.Close();
    }
}

Form you want to be based on template:

public partial class MainForm : BaseForm
{
    public MainForm()
    {
        InitializeComponent();
    }
}

Here's a larger example in VB http://www.java2s.com/Code/VB/GUI/InheritsfromBaseForm.htm
And some info about it from MS http://msdn.microsoft.com/en-us/library/aa983613(v=vs.71).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜