Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace String_To_hex
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void tbString_TextChanged(object sender, EventArgs e)
- {
- tbHex.Clear();
- char[] chars = tbString.Text.ToCharArray();
- string hexString = "{";
- foreach (char currentChar in chars)
- {
- string hex = Convert.ToByte(currentChar).ToString("x2").ToUpper();
- hexString += "0x" + hex + ", ";
- }
- hexString += "}";
- tbHex.Text = hexString;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement