С помощью этого элемента управления, можно задать шаблон ввода текста, а так же автоматически форматировать введенные данные.
Form1.cs
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1 {
-
public
partial
class
Form1 : Form {
-
public
Form1() {
-
InitializeComponent();
-
}
-
private
void
button1_Click(
object
sender, EventArgs e) {
-
textBox1.Text = maskedTextBox1.Text;
-
}
-
private
void
button1_Click_1(
object
sender, EventArgs e) {
-
textBox1.Text = maskedTextBox1.Text;
-
}
-
private
void
button2_Click(
object
sender, EventArgs e) {
-
textBox2.Text = maskedTextBox2.Text;
-
}
-
private
void
button3_Click(
object
sender, EventArgs e) {
-
textBox3.Text = maskedTextBox3.Text;
-
}
-
private
void
button4_Click(
object
sender, EventArgs e) {
-
textBox4.Text = maskedTextBox4.Text;
-
}
-
private
void
button5_Click(
object
sender, EventArgs e) {
-
textBox5.Text = maskedTextBox5.Text;
-
}
-
private
void
button6_Click(
object
sender, EventArgs e) {
-
textBox6.Text = maskedTextBox6.Text;
-
}
-
}
}
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1 {
-
public
partial
class
Form1 : Form {
-
public
Form1() {
-
InitializeComponent();
-
}
-
private
void
button1_Click(
object
sender, EventArgs e) {
-
textBox1.Text = maskedTextBox1.Text;
-
}
-
private
void
button1_Click_1(
object
sender, EventArgs e) {
-
textBox1.Text = maskedTextBox1.Text;
-
}
-
private
void
button2_Click(
object
sender, EventArgs e) {
-
textBox2.Text = maskedTextBox2.Text;
-
}
-
private
void
button3_Click(
object
sender, EventArgs e) {
-
textBox3.Text = maskedTextBox3.Text;
-
}
-
private
void
button4_Click(
object
sender, EventArgs e) {
-
textBox4.Text = maskedTextBox4.Text;
-
}
-
private
void
button5_Click(
object
sender, EventArgs e) {
-
textBox5.Text = maskedTextBox5.Text;
-
}
-
private
void
button6_Click(
object
sender, EventArgs e) {
-
textBox6.Text = maskedTextBox6.Text;
-
}
-
}
}