it depends how you would like to do it , Have a hash of a users hardware id , have it just a random code with "-" in it , have it check online etc Jed
xEvOx
Posts
-
Product key feature -
(Xml) Reading a Selected Node Attributes [modified]right usually when i read Xml I do it like this :
XmlDocument XmlDoc = new XmloDocument();
XmlDoc.Load("C:\\Example.xml");
XmlNodeList XmlnodeyList = XmlDoc.SelectNodes("Xml/Node");
foreach(XmlNode Nodey in XmlNodeyList)
{
listView1.Items.Add((string.format("{0}", Nodey.Attributes["ExampleNode"].Value.ToString())));
}Now that then populates a listview with the nodes in the xml file, I now have been pulling my hair out trying get it to red the second area of the nodes for example in the xml file :
Sorry CodeProject Wouldent display it properally :)
i want it to read the SecondNode but since i have say 4 of them all diffrent i want it to then read it and make a label have the secondnode text from the listview selected item , Here is the code i wrote for it :
string Name = listView1.SelectedItems[0].ToString();
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.Load(XmlPath);
XmlNode Nodey = XmlDoc.SelectSingleNode(string.Format("Xml/Node/{0}", Name));
label1.Text = (string.Format("{0}", Nodey.Attributes["SecondNode"].Value.ToString()));so on click from the listview it gets the second node etc , any help wouyld be grand guys ! Jed
modified on Saturday, April 3, 2010 5:11 AM
-
Adding 2 Zeros after each byte in textboxok i really hounestly (on my own mind and heart) cant think of ANY code to start this, right so a value in a textbox say equals "999" i want to then convert it to hex (i know how to do that with SB) then having it add 1 byte (00) after each byte so : "3900390039" how would i go about doing this ? Thanks
-
Byte Array to uint (Hex Decimal Value) Little help [I Solved It]I solved it , Here is the code :
(new Class)
public static string HexToAscii(byte[] hex)
{
string ascii = "";
for (int i = 0; i < hex.Length; i++)
{
string temp = hex[i].ToString("X");
if (temp.Length == 1)
temp = "0" + temp;
ascii += temp;
}
return ascii;
}public static uint BytetoUint(byte[] Data)
{
string Array = Conversions.HexToAscii(Data);
int i = int.Parse(Array, NumberStyles.HexNumber);
return Convert.ToUInt32(i);
} -
Set current form to hide [modified]this how i hide a form and open a new one
Form1 form = new Form1(); // new Form
this.Visible = false; // The Current Showing Form Hides
if(form.ShowDialog() == DialogResult.OK) // Makes Form Show
{}
this.Visible = true; / on close of the form you opened the one you started from shows:)
-
Byte Array to uint (Hex Decimal Value) Little help [I Solved It]Code :
public static uint GetUintFrombyte(byte[] ByteArry)
{
string Array = ByteArray.ToString(); /OR/ string Array = BitConverter.ToString(ByteArray);
int Value = int.Parse(Array, NumberStyles.HexNumber);
uint Value2 = Value;
return Value2;
}Now here i read 4 bytes Binary reader : byte[] Hex = br.ReadBytes(4); Hex Now ='s 00000001 00000001 to a int value should = 1 then transfering it to a uint , but it isnt seemingly doing it . Error comes up as on int value "Error : Invalid Format " Any Help ? Thanks
modified on Sunday, February 7, 2010 11:58 PM
-
Trying to open a new tab(User control embedded)right my aims are to create a kind of wizard , i dont know how to use the wizard class so i thought of some quick code for it and it didnt work *sigh* anyway so i have a tabcontrol on the gui (DotNetbar) and then once i open the first user control and on the first one call back to form1 with a public void for example :
public void SetPage(int PageNum)
{
if (PageNum == 1)
{
Page1 page1 = new Page1();
page1.Dock = DockStyle.Fill;
page1.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page1);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 2)
{
Page2 page2 = new Page2();
page2.Dock = DockStyle.Fill;
page2.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page2);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 3)
{
Page3 page3 = new Page3();
page3.Dock = DockStyle.Fill;
page3.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page3);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 4)
{
ErrorPage error = new ErrorPage();
error.Dock = DockStyle.Fill;
error.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(error);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 5)
{
FinishPage finish = new FinishPage();
finish.Dock = DockStyle.Fill;
finish.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(finish);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
}so the command on the form would be SetPage(1); for page 1 but for another on user control i would ha