Hex to Oct Vice Versa Converter Using c#


/*First u must create a Ui*/


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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int x, flag = 0;
for (x = 0; x <> 97 && textBox1.Text[x]
<> 64 && textBox1.Text[x] < flag =" 1;"
flag ="=" text = "" val =" 0," power ="
(textBox1.TextLength" str = "" str2 = "" i =" 0;"
num =" val;" rem =" num" num =" num" rem ="="
rem ="=" rem ="=" rem ="=" rem ="=" rem ="=" i ="
str.Length">= 0; i--)
{
str2 += str[i];
}
if (textBox1.Text == "0")
textBox2.Text = "0";

textBox2.Text = textBox2.Text + str2;
}
else
{
MessageBox.Show("Value should not have digits like 8, 9 or any alphabet!");
textBox1.Text = "";
}

}

private void button2_Click(object sender, EventArgs e)
{
textBox4.Text = "";
int val = 0, power = (textBox3.TextLength - 1), i;
int num, rem;
String str = "", str2 = "";


for (i = 0; i < num =" val;" rem =" (int)num" num ="
(int)num" i =" str.Length">= 0; i--)
{
str2 += str[i];
}

textBox4.Text = textBox4.Text + str2;
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}


0 comments:

Post a Comment