Decimal To Hexadecimal Conversion?
Nov 25, 2009
I'm writing a small program that will convert a negative number (e.g. -200) to a hexadecimal number (e.g. FF38). And back to a decimal number. FF38 back to -200. (I can only use two bytes when converting back and forth.)
Question: is there a function in VB that will help?
View 5 Replies
ADVERTISEMENT
Aug 11, 2011
im using vb 2010 and currently working on a program that senses and displays values in hexadecimal, i have already done this part, but now im required to convert the value that is in the textbox, for example 006d to 109.
View 12 Replies
Jun 18, 2009
I currently doing a project..Using VB2005 To convert hexadecimal to decimal. Something to do with serial port..
View 14 Replies
Jun 21, 2012
Possible Duplicate: How to convert numbers between hexadecimal and decimal in C#? In C, you can do something like int x = 255; printf("x is: %d and in HEX, x is: %x", x, x); How can I do that in C# or VB.net? print the variable's hex equivalent
View 7 Replies
Jul 7, 2009
This program, it reads in a file, and displays it in hexadecimal, like using a hex editor. It then goes to compare the strings and whatnot, and display certain values. During the program, there is a time where I need to display a set of offsets as decimal because that is the way that it is shown regularly.
Taking the two specific offsets and displaying them in hex ends up giving me something like "3039" or "000A", which should respectively convert to 12345 or 00010. This "ID" that I am converting, can be 00000 to 65535, which in hex is 0000 to FFFF. The current method I was given only works if the value is less than 512 or something like that.
[Code]...
View 5 Replies
Mar 1, 2010
I am currently working on a software that will convert a string to it's hexadecimal equivalent and back. I have created the following code to make the convert the string to hexadecimal, but I cannot figure out how to get it back.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim skill As String
skill = RichTextBox1.Text
Dim skillfullbyte() As Byte
[code]....
View 1 Replies
Jun 10, 2011
I need to write a new value to the registry. I have come stuck at the following code because what i can add is a standard key and i need to place a new decimal value to a DWORD key (aposed to a hexadecimal value)
{Dim wsh
wsh = CreateObject("WScript.shell")
wsh.regwrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionpoliciesExplorerNoDrivesdword", "789")}
View 1 Replies
Jun 4, 2009
Im looking for the correct solution for the 4 radiobuttons for my scientifc calculator also to calculate within it.
i have something like this: but i dont think its good enough
Private Sub rbHex_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbHex.CheckedChanged
[Cdoe].....
View 13 Replies
Jun 16, 2010
I have a DataGridView bound to a DataTable that has 1+16 columns defined as Integer.The default cell style is hexadecimal 2 digits (.Format="X2").When entering in cell editing I would like to provide to the user, the possibility to write the value in decimal or hexdacimal.Hexadecimal could be written like, for example, 0x00, 0X01, x02, XFF
Decimal like 0, 1, 2, 15For this reason in EditingControlShowing I add "0x" to the TextBox value
Private Sub BankGrid_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
Dim grid As DataGridView = DirectCast(sender, DataGridView)
[code]....
View 2 Replies
Oct 18, 2010
i m working on an application which communicates with PLC machine using Modbus protocol. Now i m able to generate and communicate a modbus data frame with PLC the only problem that i m facing is that in all the data frames of modbus the last ascii characters should be Carriage return + Line feed which should be read by the PLC as 0D 0A that is in Hexadecimal form. But i m not able to do this. The rest entire string is properly read by the PLC but How do I make it read the CR+LF.
View 2 Replies
Sep 1, 2009
I am writing a program and have run into an issue. The program requires a conversion of time (e.g. hours,minutes,seconds) to a hexadecimal value of no more than 4 bytes (e.g. FFFF). I have no idea how this is done. Can anyone point me to a tutorial or give a quick explanation. Sample code would be great as well.
View 2 Replies
Jun 13, 2011
i m trying to write a program that displays in a textbox a table of the binary, octal, and hexadecimal equivalents of the decimal numbers in range 1-222.
View 3 Replies
Oct 27, 2009
I have a Form with 4 Text Boxes, 1 label and one button. What I need to do is: Make all the text boxes and label only except Hexadecimal inputs.when I press Button1
Label1 = TextBox1 AND TextBox2 ^ TextBox3 MOD TextBox4
Once again every all the numbers are in Hexadecimal format.
View 1 Replies
May 3, 2011
im having trouble understanding this question for a homework assignment. I need to write the PSEUDOCODE for the following scenario, but i got no idea about how to convert a hexadecimal number to a decimal number..You are required to input a two digit hexadecimal number eg. 3f (digits can be entered separately) and calculate the equivalent decimal number. (note the decimal number will be between 0 and 255) . output the decimal number
View 1 Replies
Jul 9, 2009
i have 2 textbox's 1 button and im trying to convert the text in one textbox(decimal) to show a hex value in the other textbox via the button click event
View 3 Replies
Mar 6, 2010
I write a program to convert Decimal numbers to Binary numbers. It is working well. But I want to control the bits. i.e - We can write 31 as a) 11111 or b) 011111. When I run my program it displays 11111. I want to take input bit from a text box and display it like 0011111 or 011111 or what ever bit I input. How can I do that ?
Private Sub DecToBin()
Dim i As Integer = txtDec.Text
Dim binary As String = Convert.ToString(i, 2)
txtBin.Text = binary
End Sub
View 5 Replies
Apr 24, 2009
i have the decimal 0,22727272727272727272727272727273 and i like to convert it to hour, minute, second, the zero represent hour.
View 6 Replies
Jun 9, 2011
So, yes, I've tried with these three formats, and the problem remains the same:I have a string, "s"For Each s As String In stringarray and this array is recieving data from a streamreader that is reading a csv file. The data I'm having dificulty reading are these very specific numbers(yes, only these numbers, because phone numbers get home safe and sound).The numbers I'm talking about are usually decimal.ValueList.Add(Convert.ToDecimal(s))
Now, when I convert them like that, they always bring a "D" alongside with them. I've personally checked the string multiple times, and it just has a "1", and somehow, my list recieves "1D" as a number, same thing happens with decimal numbers(0.29D for example). I've tried with Doubles and Integers, the result is the same.
View 1 Replies
Jan 6, 2010
I have this code for a decimal to binary conversion in a calculator. It is working, but when I entered numbers with decimal, the conversion didn't work.[code...]
View 3 Replies
Feb 11, 2009
I am writing a program that asks the user for their name and the number of pieces they completed. The employees are paid more depending on the amount of pieces they have completed(i.e. <200 = .50 per piece, 200 to 399 = .55 per piece, etc.). I have to display the amount earned when the user enters the info and hits the calculate button. I have to use Select Case.
I was thinking this would be an easy program but I keep getting an error for each Case saying "Option Strict On disallows implicit conversions from 'Double' to 'Decimal'. I don't understand why it thinks it is a double. It says I can correct this problem by adding "Cdec" before each equation(i.e.
[Code]...
View 5 Replies
May 17, 2012
in simple application, when i am trying to convert string "$2432.23" to decimal (i have taken reference from a book, that cDec can handle $ and , ), it gives error InvalidCastexception
Dim amt As Decimal = CDec(txtSubtotal.Text)
i entered "$2432.23"
View 2 Replies
Jan 3, 2012
VS 2008 Conversion from string to decimal problem on XP and 7
View 1 Replies
Mar 7, 2010
I want to take more than one number separated by one space from txtDec textbox and display their binary form again separated by one space in txtBin textbox.
My code below ---
Private Sub DecToBin()
Dim i As Integer = txtDec.Text
Dim binary As String = Convert.ToString(i, 2).PadLeft(8, "0"c)
txtBin.Text = binary
End Sub
View 3 Replies
Sep 18, 2009
I have a problem converting decimal number from label's string to decimal... (for example Label1.Text = "0.5"). It works fine on Vista, where I made my application, but it doesn't work on XP and 7. It converts from 0.5 to 5
VB
Dim dec1 As Decimal
dec1 = CDec(word1) * CDec(u1.Text)
'word1' is an integer. For example, if word1 is 100, on XP I get result 500.
View 13 Replies
Jan 28, 2010
Please excuse the newbie question as I started learning VB last week . I wrote the following test code below to add two values entered in two textboxes and display it in another textbox. However I keep getting the exception. "Conversion from string "" to type 'Decimal' is not valid" with the code below and I cannot figure out why . I thought converting using 'CDec' resolves this issue ?
View 3 Replies
Jun 22, 2010
I have a xml node, which can be shown in immediate window as
?Me.SelectSingleNode("./FloatAmount").InnerText
"100.00"
?typename(Me.SelectSingleNode("./FloatAmount").InnerText)
"String"
However, I want to return a decimal value.
?cdec(Me.SelectSingleNode("./FloatAmount").InnerText)
Run-time exception thrown : System.InvalidCastException - Conversion from string "100.00" to type 'Decimal' is not valid.
View 2 Replies
Mar 20, 2012
Are there any built in base number conversion functions in .Net specifically decimal to hex?
View 7 Replies
Mar 7, 2009
Cannot implicitly convert type 'decimal' to 'int'. An explicit conversion exists
View 1 Replies
Jul 12, 2011
I am calling a GetSerialNo function But it showing some error like:
Cannot implicitly convert type 'decimal' to 'int'. An explicit conversion exists (are you missing a cast?).
Here is the code:
CODE:
View 3 Replies
Jun 27, 2012
What is the cleanest, most readable way to String.Format a decimal with the following criteria
start with a sign symbol (+ or -)
a fixed number of fraction digits
no decimal separator
right aligned
pre-padded with "0"'s
View 3 Replies