|
新手写的进制转换器(写的很笨)(7) void DateTimeToString() { DateTime now=DateTime.Now; string format; label6.Text=""; format="yyyy-MM-dd HH:mm:ss"; label6.Text=now.ToString(format); } private void button1_Click(object sender, System.EventArgs e) { //转ASCII码 str=textBox1.Text; int a; if(str.Length>1) MessageBox.Show("ERROR,Please input the char!"); a=(int)str[0]; textBox2.Text=a.ToString(); } private void textBox1_TextChanged(object sender, System.EventArgs e) { } private void button2_Click(object sender, System.EventArgs e) { if(textBox3.Text!="") { T_S(); T_Tw(); } else if(textBox4.Text!="") { Tw_T(); Tw_S(); } } //由十进制转十六进制 void T_S() { string ten; int b=0; ten=textBox3.Text; for(int i=0;i<ten.Length;i++) { int c=1; for(int j=ten.Length-i-1;j>0;j--) { c=c*10; } if(ten[i]>57 ten[i]<48) MessageBox.Show("错,输入的应该是十进制整数。");
|