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 ByteToASCII
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
byte[] toASCII = new byte[4];
toASCII[0] = Convert.ToByte(textBox1.Text,10);
toASCII[1] = Convert.ToByte(textBox2.Text,10);
toASCII[2] = Convert.ToByte(textBox3.Text,10);
toASCII[3] = Convert.ToByte(textBox4.Text,10);
textBox5.Text = System.Text.Encoding.ASCII.GetString(toASCII);
}
}
}
先new一個byte陣列,利用Convert.ToByte(String,多少進位)來轉換,存如byte陣列當中
之後用Sytem.Text.Encoding.ASCII.GetString(byte陣列) 即可轉換
End
沒有留言:
張貼留言