• We just launched and are currently in beta. Join us as we build and grow the community.

Convert Number to Hexadecimal in VB.NET

shakira

Container Orchestrator
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
174
Likes
77
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
In this article, we will create a program that can convert a given number into hexadecimal equivalent. Hexadecimal describes a base-16 number system, that is 0 to 9 and A to F.

Now, let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add only one Button named Button1 and labeled it as "Convert". Insert two textboxes named TextBox1 for inputting a desired number and TextBox2 for displaying the output in the hexadecimal equivalent. You must design your interface like this:

hexadesign.png


3. Put this code in your Button1_Click. This will trigger to convert the inputted number in textbox1 and display the output in hexadecimal form in textbox2.
  1. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click
  2. Dim

    hexNumber As

    String

    =

    Hex

    (

    TextBox1.

    Text

    )
  3. TextBox2.

    Text

    =

    hexNumber
  4. End

    Sub


We have first initialized variable hexNumber as a string that will hold the equivalent of a number inputted in textbox1 as we have the Hex function. Hex function returns a string that will represent the hexadecimal value of a number inputted in textbox1. Then the hexadecimal value equivalent in textbox1 will be displayed in textbox2.

Output:

hexaoutput.png


Download the source code below and try it! :)

For more inquiries just contact my number or e-mail below.

Best Regards,

Engr. Lyndon R. Bermoy

IT Instructor/System Developer/Android Developer

Mobile: 09079373999

Telephone: 826-9296

E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,341

323,350

Top