Thanks for your help. Simon
-----Original Message----- From: Richard Birkby [mailto:[EMAIL PROTECTED]] Sent: 07 May 2002 12:09 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Convert Hex to Decimal UInt32 MyInt=System.UInt32.Parse(textBox1.Text, NumberStyles.HexNumber); Richard > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf > Of Powell, Simon > Sent: 07 May 2002 11:07 > To: [EMAIL PROTECTED] > Subject: [DOTNET] Convert Hex to Decimal > > > Hi, > > I have a text box that excepts a hex value. How do I then convert to > uint32 to pass to an API? > > Below is a code snippet: > > private void button1_Click(object sender, System.EventArgs e) > { > if(this.textBox1.Text == "") > { > MessageBox.Show("You must enter an > error code!", "Error", > MessageBoxButtons.OK, > MessageBoxIcon.Error); > return; > } > > > int Rtnval; > uint ErrorCode = > Convert.ToUInt32(this.textBox1.Text); > StringBuilder sMsg = new StringBuilder(256); > > const uint FORMAT_MESSAGE_FROM_SYSTEM = > 0x00001000; > const uint FORMAT_MESSAGE_IGNORE_INSERTS = > 0x00000200; > > Rtnval = > FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | > FORMAT_MESSAGE_IGNORE_INSERTS, > 0, ErrorCode, 0, sMsg, 256, 0); > > this.textBox2.Text = sMsg.ToString(); > } > > Any help will be much appreciated. > > Simon Powell > > > ---------------------------------------------------------------------- > If you have received this e-mail in error or wish to read our e-mail > disclaimer statement and monitoring policy, please refer to > http://www.drkw.com/disc/email/ or contact the sender. > ---------------------------------------------------------------------- > > You can read messages from the DOTNET archive, unsubscribe from > DOTNET, or subscribe to other DevelopMentor lists at > http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. ---------------------------------------------------------------------- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. ---------------------------------------------------------------------- You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.