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.

Reply via email to