Post: C# HELP : Displaying Hex values in a Listview
12-29-2016, 10:03 PM #1
Algebra
[move]mov eax, 69[/move]
(adsbygoogle = window.adsbygoogle || []).push({}); So I am having trouble displaying Hex values in a Listview in C Sharp.

What am I trying to do ?

A1. I am trying to increment a drop down list of byte values displaying as Hex starting from 0x00 to 0xFF

A1 : For Example

0x00
0x01
0x02

& so on. But all I get is

00 - FF

How can I implement it like in the A1 Example>?

Any help would be much appreciated thanks.

Code :


    

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace AlgeAPI
{
public partial class Main : Form
{
public static ListView Items = new ListView();
public Main()
{
InitializeComponent();
}


private void Connect(object sender, EventArgs e)
{


}


private void Export(object sender, EventArgs e)
{
using (SaveFileDialog std = new SaveFileDialog() { Filter = "Text Documents | *.txt", ValidateNames = true })
{
if (std.ShowDialog() == DialogResult.OK)
{
using (TextWriter tw = new StreamWriter(new FileStream(std.FileName, FileMode.Create), Encoding.UTFCool Man (aka Tustin))
{
foreach (ListViewItem items in Items.Items)
{
tw.WriteLine(items.Text);
for (int i = 1; i <= 3; i++)
{
string format = i++ + "/t";
tw.WriteLine(items.SubItems[format].ToString());
}
}
}
}
}
}
public static string Hex2String(byte[] values)
{
return BitConverter.ToString(values);
}
private void DisplayValues(object sender, EventArgs e)
{
try
{
Byte[] value1 = { Byte.MinValue};
for (; value1[0] < Byte.MaxValue; value1[0]++)
{
string inputVal = "0x";
string input = Hex2String(value1);
listView1.Items.Add(inputVal + input);


if(value1[0] == Byte.MaxValue)
{
break;
}
}
}
catch(Exception ex)
{
MessageBox.Show( "Error continious loop original Error : " + ex, "Error Exception thrown");
}
}
}
}

12-29-2016, 10:04 PM #2
Algebra
[move]mov eax, 69[/move]
Never mind I fixed the code lmfao I just didn't test it <3

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo