01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.ComponentModel;
04.
using
System.Data;
05.
using
System.Drawing;
06.
using
System.Linq;
07.
using
System.Text;
08.
using
System.Threading.Tasks;
09.
using
System.Windows.Forms;
10.
11.
namespace
SampleBaseForm
12.
{
13.
public
partial
class
frmBase : Form
14.
{
15.
public
frmBase()
16.
{
17.
InitializeComponent();
18.
}
19.
20.
private
void
tsmSave_Click(
object
sender, EventArgs e)
21.
{
22.
Save();
23.
}
24.
protected
virtual
void
Save()
25.
{
26.
27.
}
28.
29.
private
void
tsmClear_Click(
object
sender, EventArgs e)
30.
{
31.
Clear();
32.
}
33.
protected
virtual
void
Clear()
34.
{
35.
foreach
(var x
in
this
.Controls)
36.
{
37.
if
(x
is
TextBox)
38.
{
39.
((TextBox)x).Text = String.Empty;
40.
}
41.
}
42.
}
43.
44.
}
45.
}
46.
47.
[cs]<strong>Code (C#)</strong>
48.
[cs]
using
System;
49.
using
System.Collections.Generic;
50.
using
System.ComponentModel;
51.
using
System.Data;
52.
using
System.Drawing;
53.
using
System.Linq;
54.
using
System.Text;
55.
using
System.Threading.Tasks;
56.
using
System.Windows.Forms;
57.
58.
namespace
SampleBaseForm
59.
{
60.
public
partial
class
Form1 : frmBase
61.
{
62.
public
Form1()
63.
{
64.
InitializeComponent();
65.
}
66.
67.
68.
protected
override
void
Save()
69.
{
70.
base
.Save();
71.
72.
}
73.
protected
override
void
Clear()
74.
{
75.
base
.Clear();
76.
77.
}
78.
}
79.
}