using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ConvertNumber { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { string beConvertedstring =textBox1.Text; if (beConvertedstring.Length==6) { textBox2.Text = convert(textBox1.Text); } } private string convert(string beConverted) { string temp = beConverted; string head = temp.Substring(0, 2); string body = temp.Substring(2, 2); string tail = temp.Substring(4, 2); string result = "0x"+tail+body+head; return result; } private void button1_Click(object sender, EventArgs e) { Clipboard.SetDataObject(textBox2.Text); } } }