0
Using VB.Net, design a form to create conversion CALCULATOR like Decimal number to Binary, Octal and Hexadecimal Binary number
Need help on this as it is a school assignment
3 Respostas
+ 4
What help do you need? Please show your code attempt.
Why did you tag "Python" when you need to do it with visual basic?
+ 3
Sure, I can help you design a form for a conversion calculator in VB.Net. Here's an example code that allows you to convert a decimal number to binary, octal, and hexadecimal:
Create a new Windows Forms Application project in VB.Net.
Open the Form designer and add the following controls:
Label1: "Decimal Number"
TextBox1: to input the decimal number
Label2: "Binary"
TextBox2: to display the binary equivalent
Label3: "Octal"
TextBox3: to display the octal equivalent
Label4: "Hexadecimal"
TextBox4: to display the hexadecimal equivalent
Button1: "Convert" to trigger the conversion
Button2: "Clear" to clear all fields
Double-click on the "Convert" button to create an event handler for the Click event.
Add the following code to the event handler:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Get the decimal number from TextBox1
Dim decimalNumber As Integer = Integer.Parse(TextBox1.Text)
' Convert decimal to binary, octal, and hexadecimal
Dim binaryNumber As String = Convert.ToString(decimalNumber, 2)
Dim octalNumber As String = Convert.ToString(decimalNumber, 8)
Dim hexNumber As String = Convert.ToString(decimalNumber, 16).ToUpper()
' Display the results in TextBox2, TextBox3, and TextBox4
TextBox2.Text = binaryNumber
TextBox3.Text = octalNumber
TextBox4.Text = hexNumber
End Sub
Double-click on the "Clear" button to create an event handler for the Click event.
Add the following code to the event handler:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
' Clear all TextBoxes
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
End Sub
NO GUARANTEE - I USED CHATGPT=== WHY NOT YOU?
0
Thanks