engr.ahayee
Member
- Joined
- Aug 10, 2021
- Messages
- 16
- Programming Experience
- Beginner
Hi all.
I want to do a simple task. take input from user and display its hex value in output field.
for example user input this string "210H1873DF12345"
The Hex value will be "32 31 30 48 31 38 37 33 44 46 31 32 33 34 35".
Following are the images of my interface and values stored in "data" variable.
kindly suggest me some solutions
Thanks
I want to do a simple task. take input from user and display its hex value in output field.
for example user input this string "210H1873DF12345"
The Hex value will be "32 31 30 48 31 38 37 33 44 46 31 32 33 34 35".
Following are the images of my interface and values stored in "data" variable.
program:
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 sampleApplication
{
public partial class Form1 : Form
{
public string input_String;
public byte[] data = new byte[20];
public Form1()
{
InitializeComponent();
}
private void btnConvert_Click(object sender, EventArgs e)
{
input_String = txtInput.Text;
for(int i=0; i < input_String.Length; i++)
{
data[i] = Convert.ToByte(input_String[i]);
}
}
}
}
kindly suggest me some solutions
Thanks