VS 2010 : Add Hex Values Together?
Dec 20, 2010
I'm trying to write a tool for our Field Engineers to help verify data they come across at customers sites. I need to be able to convert a series of characters to Hex, and then add the values of each Hex pair together, then take the last 2 digits of that sum and use it as a checksum to verify the line's contents.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim byteArray() As Byte
Dim hexNumbers As System.Text.StringBuilder = New System.Text.StringBuilder
[code]...
This takes whatever text is entered in Textbox1, and outputs the corresponding HEX values in Box2.For example, "HI" = 48 49 (output as 4849). What I need to now figure out is how to either sum the character values together, or maybe split them apart into an array and add each line of the array together(so I need to add 48+49, to get 91 in this case) I thought about using the "hexnumbers.tostring()" line to then split the string, and add each pair together, but this does not work if there are letters involved, since you can only add letters in Hex.
cliff notes version:Need to add to the above code, so that it takes text entered, such as "HELLO" which = a hex value of "48454C4C4F" and adds 48+45+4C+4C+4F, which should = 174, and then strips everything but the last two digits, so in this case "74".
View 4 Replies
ADVERTISEMENT
Mar 18, 2011
I'm trying to add some values into a .sdf, but I'm getting the error: cmd.ExecuteNonQuery(): [Token line number=1, Token line offset=202, Token in error=WHERE]
vb.net
Dim insertSQL As String = "INSERT INTO myTable(color1, color2, color3) VALUES (@color1, @color2, @color3,) WHERE name=" & myCombobox.Text
Try
[code].....
View 6 Replies
Apr 11, 2012
I know this is possible but not quite how... I'm trying to implement another application start it up invinsible and get/set values inside textboxes. Nothings totally impossible in VS but i guess this might not be easy.
View 6 Replies
Mar 7, 2011
Im using lockbits to get some img data and the img depth is 24 bit. This means that when i read the values from memory I get the following result. BLUE GREEN RED And I need them in the RED GREEN BLUE Format. I don't know if i can just reverse the bits (i don't know how) or if i need to extract the the values independently(I also don't know how to do this.
View 9 Replies
Jul 8, 2011
I am writing an administration tool for a game. I have a list of weapons in the game, and each weapon has a unique Id (numeric). Until recently I had this Id just 0, 1, 2, 3, etc... Now however I need some way to allow the user to restrict use of some weapons, and store that information in an Access database. The most obvious approach I thought was to give the weapons Ids that were powers of two: 1, 2, 4, 8, 16, etc... This way, a user can check a number of weapons (via checkboxes or whatever), and I simply store the sum of their Ids in the database. Then I can use a bitmask and the bitwise And operator to check which weapons are restricted and which aren't.
Example: the user selects weapons with Id 2, 4 and 16. The database then stores the value 2+4+16 = 22. Later, I come around and want to check if some weapon is restricted. I then take the bitwise AND operator of 22 and the Id of that weapon. If the result is the Id of the weapon, that means the weapon is restricted. Just the usual bitmasking..Anyway... Long story short: that won't work for the simple reason that I have too many weapons! There are 81 weapons (and counting...) if I counted correctly, which means I'd need values up to 2^81. As far as I know no integer value type in .NET supports numbers that high, except perhaps the BigInteger. But remember: I have to store those Ids in the database as well theoretically even up to 2^82 - 1 if the user decides to restrict every weapon), and I don't think an Access database supports anything over 2^64 (long).
View 10 Replies
Nov 10, 2011
I'm confused at the variety of different ways to say "null" in VB.net. I've got text and numerical fields with checkboxes to mark unknown values; I just want to populate a table with the fields' values (if the corresponding checkbox is not checked) or null values (if checked) so I can later input them into a mySQL database.So my question is just which of the various null types I should be using in what situations.
View 6 Replies
May 25, 2012
how to calculate "InvTotalTextBox" and "InvDiscountTextBox" values then show the result in "InvNetTextBox"..?
how can i do..?
three TextBoxes in a form
InvTotalTextBox, InvDiscountTextBox and InvNetTextBox
InvTotalTextBox is Binding with Table Field "InvTotal"
[Code]....
View 4 Replies
Apr 13, 2009
visual studio 2010 - Altering array values in VB.NET
View 8 Replies
Sep 25, 2011
I have a Datagrid with 5 columns, one of those columns is the only one to have fixed values.Let's put this in a simple way, that column (lets name it column A) contains rows with values from one to ten.With an API call I get some information, lets say I got this:
1 - Andrew - 1.8
8 - Peter - 2.8
Something like this.The first number is equal to the value on the column A, the other two are name and height. I will note receive all the values (one to ten) with call or full information relating to all the columns.How can I assign the information I receive to the proper row based on one of the value I get with the call? Another thing, I will have to create a lot of rows, do I need to add them row by row?
View 8 Replies
Oct 11, 2009
I want to store say like 8 values, that in the end will be combined into one string. What's the best way to store them? They should be reached in a own namespace I did. In a separate .vb file. I want to able to edit them. The values are both text and numbers. So whats the best way according to you?
View 3 Replies
Oct 7, 2011
I want to get the value of the selected item for example I want to get the first cell which is the quantity and store it in a textbox which I will select in the datagrid. How can I do that I am new with datagrid.
View 19 Replies
Dec 16, 2011
I'm building some lists of selected values from listboxes; it's easy to retrieve the text like so:
For Each item In Listbox1.SelectedItems
ParameterList.Add(Listbox1.GetItemText(item))
Next item
What is the corresponding way to return the value rather than the text, in the event that they're different?
View 5 Replies
Mar 7, 2011
I use this code to save some TextBox values to XML, but when I try to save some more, it overwrite the first one. What am I supposed to do in order to save more contacts?
Imports System
Imports System.Xml
Private Sub ProsthikiBTN3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProsthikiBTN3.Click
Dim settings As New XmlWriterSettings()
settings.Indent = True
[Code] ......
View 5 Replies
Apr 25, 2012
I have a textbox called textbox1. I wanted to limit it to only two characters, so I added the code TextBox1.MaxLength() = 2, however this textbox is for user input and only want to allow numeral values 0-99. And if the user entered a non-numerical value an exception would occur so I need help on to handle that.
View 2 Replies
Sep 18, 2010
How can i possibly multiply two values in datagrid when a text change happens. Here is my layout:
Here is the code I used but its giving me an error:
Private Sub dgvSalesEntry_CellValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvSalesEntry.CellValueChanged
Dim ind = dgvSalesEntry.CurrentRow.Index
[code]....
Error Message: An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.But when I deleted the codes above I can run my system.
View 4 Replies
Jan 25, 2012
I have 5 textboxes named as txt1, txt2, txt3, txt4, txt4. Only numbers are allowed in these fields. I have another textbox named txtSubTotal which is calculated (SUM) from the values entered in the above five textboxes. What is the best way to calculate totals when numbers are entered or modified in any of the five textboxes?
View 2 Replies
Mar 25, 2012
I have an array of structs and each struct contains values for the checkboxes. I am trying to display the checkbox values contained within a particular struct.
MyStruct is an array of structs which has a values for the checkboxes
ChkBoxCol is the collection of check boxes for the form.
I am iterating through the collection as follows:
[Code]...
What I am noticing is that if the check boxes are checked in order (checkbox 1, 2, 3, 4...etc) the code works fine and the values are displayed correctly in the form. However, if the check boxes are not checked in order (4, 5, 7...etc) the code does not write the values of the check boxes and instead keeps them blank. I just need to display the values for the check boxes for a specific struct.
View 5 Replies
Feb 23, 2011
I am working on a way to change either the x or y value of a point and am getting an error while doing so. the code i am using to do this is the following:pts(currentNo - 2).X = pts(currentNo - 2).X - 10pts is a list of Points and currentNo is merely a count that im using to track where i am in the list. I am getting the following error
View 2 Replies
Feb 18, 2012
i think its hard to explain, but here we go.I have a combobox, where you should be able to add item (in this case colors/Hexcode selected from colordialog).So lets say we have 3 items in that combobox:and if you pick blue, the color blue should apper in a background color.I can only get names to work, but i cant find out how to store the hex value data.
View 6 Replies
May 6, 2011
I have this code so that when you check a checkbox it drops the item value into the textbox. What I would ultimately like is for the items to be inline and followed by a coma. Atleast on the same line.[code]
View 7 Replies
Mar 26, 2012
i want to get two output values in one Function is't possible ?.i am just using String data type and split the values.but have any other easy way to get two output values
View 1 Replies
May 13, 2012
So far I have code for a textbox that limits the value entered by a user to two value places. However, I would like to limit the value entered by a user to numerical values only. And to handle any exceptions that go along with it.
View 2 Replies
May 12, 2012
I have a textbox called textbox1. I wanted to limit it to only two characters, so I added the code TextBox1.MaxLength() = 2, however this textbox is for user input and only want to allow numeral values 0-99. And if the user entered a non-numerical value an exception would occur
View 3 Replies
May 28, 2012
I havew a smal xml file which looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<fv>
<flv url="http://www.mysite1.com">Windows</flv>
[code].....
View 4 Replies
Apr 18, 2012
Im having trouble getting the sum of a "Status Column" It is unbound. It has 2 Items "Active and Inactive" I would like to have lblInact.Text to show the total of Inactives of that column.
View 20 Replies
Jul 22, 2011
I have a program that has to store a pre-made array that contains strings (moviename, moviegenre).
I setup all the items in the array already, example:
moviearray(0,0) = "Green Lantern"
moviearray(0,1) = "Action"
For this example, if the user selected "Green Lantern" from my listbox, then the label needs to display "Action". So yeah, it's a 2-column array: first column = movie name, 2nd column = movie genre. Now, I have a listbox containing all of the movie names (not entered by the array, but entered through the Item property of the listbox). When a selection is made in the listbox and a button is clicked, I need to have the genre of the movie output to a label. That is where I am stuck, I just can't figure out to compare what's in the list box with the first column of the array to output the 2nd column to the label.
View 15 Replies
Jan 1, 2012
I have a form with 3 tabs: one tab is for user entry and computations, a second tab shows values that will be used for computations which are read from one database (I call it settings in that the values are constants for calculations but it's not application settings in the way people think of it, to be clear) and the third displays a table from another database. The second tab has a table adapter interface for the dataset that contains values used for calculations that can be changed (to do different scenarios.) Those numbers are read from a single record in a database that has 20 fields and was read once when the data is loaded into the second tab to be displayed.
The problem I am having is that I would like to use the numbers from the second tab (the constants) in computations to be shown on the first tab. I have tried declaring the variables on the second tab as public but they are already "friends" with the form event. However, when I go to use them in calculations, it's like they don't exist.
For example, one calculation I am doing is fuel cost. The user enters miles and this is stored as a variable called mileage. To calculate the result fuelcost, I have to use two other fields that are shown in the second tab: MPG (miles per gallon) and fuelprice (the price of gas). So fuelcost = (mileage/mpg)*fuelprice. These are read from a datatable called testdata which is actually part of the project. I want to be able to use these variables throughout the program but declaring them as public isn't working.
How do I make the variables from one tab usable elsewhere in the program? The other thing I noticed is since the values of the variables are loaded into textboxes and assigned variable names by naming the textboxes, using val([variablename].text) isn't solving the problem either. For example, saying milespergallon = val(mpg.text) is not doing the trick because I am getting a message that 'text' is not an integer when I declare milespergallon.
Update Here the code that is being used:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mileage = Int32.Parse(Miles.Text)
Dim rate = 0
Dim baserate = 0
[code]....
TabPage2 is where the variables are displayed that I want to use in TabPage1.
Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage2.Click
End Sub
View 2 Replies
Jul 18, 2011
I want to send hex values across the serial port. I know, I know, your thinking not this again. But what I need to do does not seem to be addressed, or I am some how missing it when I search around.
[Code]...
View 2 Replies
Jan 3, 2011
I currently have an arraylist holding many separate numbers and I need to loop through the array and change each number, the number will be changed depending on other determined settings but I can't seem to get this to work,
For i = 0 To Me.TextBefore.Length - 1
intTemp = CInt(Me.textarray)
intTemp = intTemp + intUsr
Me.intarray.Add(intTemp)
Next i
View 4 Replies
Dec 16, 2010
I've been trying to make a grid to test some AI stuff I'm working on. I managed to do it using rectangles and graphics.rectangle (pens.black, rect) by using a vid on youtube, but it made the application virtually useless because of all the memory it was using. I don't need it to be an actual grid, but I do need it to have values as if it was a grid, so that I can issue commands (x,y coords). (I have been searching the forums for over an hour, but all examples are either useless or cant be converted correctly).
View 6 Replies