Create A Decimal Array?
Nov 15, 2011I need to create an array of decimals by getting input from the user. I know how to create one of random numbers but do not know how to get the input from a user through a text box to a list box.
View 1 RepliesI need to create an array of decimals by getting input from the user. I know how to create one of random numbers but do not know how to get the input from a user through a text box to a list box.
View 1 Repliesinitialize an indefinite (eg. Decimal) array without setting boundaries on the array length?
View 2 RepliesWhat 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
I'm trying to get my exersize to work but am stuck on 2 fronts.
1. I don't seem to find a way to reset my resultArray. As it works now i get the result from the first test second test and so on each time.[code]
2. My print function doesn't read 'nothing'.I'm pretty sure that when i find a way to empty resultArray i'll fix this problem at the same time.But for now i'm hopelessly stuck.[code]
I want to sort a decimal array (currency with the places). I'm sure that I could find a bubble sort and modify it to suit my needs but it would seem that there would be a clean solution out there so I don't have to reinvient to wheel.
View 3 RepliesI'm trying to figure out how to convert a string to a decimal array (ASCII). The string can be any length and is discovered at runtime.
View 4 RepliesI have this function in my generator.[code]Despite the data type being passed into the constructor of the CodePrimitiveExpression object being a decimal, the code generated is an integer that gets implicitly converted and stored in a decimal variable. Is there any way to get it to generate with the "D" after the number as in: Public Const DollarAmountMaximumValue As Decimal = 100000D
View 1 RepliesDoes anyone know how to read a single column array from bottom up, then back down, filled with decimal data, into one line seperated by comma's?
a = 0
Do Until a > decArray.Length - 1
test = decArray(a)
[code]....
how do you convert a decimal ( decimal place holder = dot) to a decimal (decimal place holder =comma)?
View 6 RepliesOdbcDataReader in showing decimal fields Decimal separator disappear with DB2 dsn
View 3 RepliesThis was an experiment to see if I could create a fake array using generics instead of using an array. I decided to try it, because I may use it if I find any advantages to using it over an array. it works, I am just asking for a second or third opinion, have I screwed anything up, or is there an easier way to accomplish this? If I use it, it will be for a 2D game I am creating, and is used to draw the 2D screen graphics, placing an image based on what image identifier is located at what coordinates. The value stored in the fake array is an integer that disignates the graphic to draw and whether it is passible or not, i.e. 0 = a floor image, 501 = a wall image that is impassible (any image number > 500 is impassable) The Class definition:
[Code]...
After converting all degrees-->decimal, and decimal-->hours, how can i use Tan, Cos and Sin formula in vb.net? I want the user must enter an input (which it is a coordinat-->i already convert the degrees-->decimal value as suggested by stanav and paul.
The questions like this (i only calculate on paper but dont know how to implement in code):
Input user need to enter:
-latitude local (e.g. 1.4875)
-longitude local (e.g. 103.3883333)
[CODE]...
My user requests to change the . on the numpad to a when entering text in a multiline textbox.So I was thinking about the KeyDown event.To determine if the numpad . was pressed I can do something like this [code]But now how do I change the returned charachter as a , ? All e.Key... properties are ReadOnly. The KeyPress events let me change this by providing e.KeyChar, but in that event I can't check for the numpad .
View 2 RepliesHow would I go about rounding up decimal numbers to the nearest 2 decimal places? For example $7.0000032 would be $7.01 In theory, VB would make it $7.00 but if it is > $7.00, I want it to reflect that to the nearest penny... so $3.0000001 would be $3.01
View 5 RepliesIf I have the code:Dim x as Decimal = 100.0m
Is it casting from a double to a decimal implicitly. How would I do this explicitly in vb.net?
1) One Decimal Varibale stores a decimal value
2) The value must be converted in string ( some time the comma is used as decimalplaceholder some time the dot)
3) the user modifies the value
4) i need to riconvert the string back in decimal
how can i do this
so:
Variable 123.34D ----> textBox 123,34 or 123.34 -----> variable 123.34D
Is there a way in VB .NET to have a decimal variable with 40 decimal places?
View 3 RepliesMaybe this is just a really basic question that everyone knows the answer to, and is why I couldn't find the answer. What I want to do is pretty simple. I want to declare a custom type that's just like a Single, except when you access the value, you get the value rounded to the second or third decimal place. Something like this:
Dim MyNumer as TwoDecimalNumber
MyNumer = 1.124
Msgbox(MyNumber) 'This would pop up a box showing "1.12"
[Code]....
Problem: Using the sub routing below, when adding a value to another value the results eventually change from 2-decimal places to multiple decimal places.Basically, the amount stored should always only be 2 decimal places, because the values passed in are always 2 decimal places. Output from calling the sub routine multiple times.
Running total = 329430.75
New Withheld Amount = 710.79
Running total = 330141.54
[code]....
As a workaround, I have a new routine that uses a custom round function to properly store only 2 decimal places - as the VB round function does not perform the type of rounding desired.I understand that we are removing the value from the dictionary and adding it back..
format number to hower many number on left of decimal and 1 decimal without rounding
View 2 RepliesI want to create an array of an array (or arraylist of an arraylist) to hold strings.I want to fill an array1 with string values Then add this array to array2. - but only taking up 1 row in array2 e.g something like array2(index)=array1 Then clear array1 then loop through this again with different data, and add it to the array2.so will end up with something like
array2(0)... contains a collection of array1 data
array2(1)... contains a collection of different array1 data
.. and so on
i think i need to make new instances of array1 each loop, but not sure.I dont mind if it uses arrays, or arraylists, or lists, or structure of arrayslists?
Ive tried making my own array, and ive practically completed it, but it doesnt seem to work. The issue seems to be that it cant convert string to type double. but do not know how to fix the error.[code]...
View 11 RepliesI just created a "Usercontrol" in WINFORMS- it just contains 1-Button with some style.And i need to use the same as array(10) and load it to a form.
Ex:Dim myButton() As Button = New ucSpecialButton(dataset4Category(i).Tables(0).Rows.Count - 1) {}
Here my usercontrol name is ucSpecialButton can we create a ONE-Dimensional Array of a WINFORM usercontrol.?
I need help creating a batch of Grand Totals each time enter my value and click Calculate.The code below gives me my Grand Total, now I would like to enter a new set of values and store the previous amount(s) until I'm ready to populate them in a Message Box.
Dim sum As Decimal = 0
For Each total As Decimal In totals
sum += total[code]....
It was so simple in VB6 but I don't know how to approach it in VB2010. I've looked the internet but each site seems to have a different solution and masses of code for something that could be done in a few lines in VB6.Here is the code I want to use. How do I go about creating a control array of 100 picture boxes pic(1) up to pic(100)?
Code:
For y = 0 To 9
For x = 1 To 10
tempObject = (Mid(StrRow(y), x, 1))
[code]....
Possible Duplicate:VB.Net Initialising an array on the fly
This maybe a stupid question, but its got me exasperated. How do I declare a new array inline? Is this possible? I've tried all of the following and they all don't work.[code]...
The more I read my book the more confused I get, as the programming example is not even close to what this assignment is I am to modify my existing project to keep track of an order in an array.
View 1 RepliesUsing VB2010, I would like to create an array of buttons and a sub procedure that when I send the index number, I will be able to change the text on the specific button.
Dim myBtn as button={button1, button2, button3}
private sub GetCaption (ByVal x as integer)
myBtn(x).text="OK" 'If x=2 I should execute button3.text="OK"
[code]....
call GetCaption(2) 'Call the sub and change the text on button2 to say OK.How do I make it work?
how to creat an array of forms : i tried this thing out:
View 11 RepliesI'm trying to create an array of Points but can't seem to get it right.
I can create an array of Integers just fine.
Dim MyArray() as Integer = {1,2,3,4,5}