Mulitply Values In Two Arrays?
Sep 25, 2010I am working on a program where I need to multiply the value (int) times the value (dec) of another array to calculate the total cost of books in inventory. [code]....
View 2 RepliesI am working on a program where I need to multiply the value (int) times the value (dec) of another array to calculate the total cost of books in inventory. [code]....
View 2 Repliesthe code below works but i having issue that the code below is erratic some times where it works fine and opens 1 x cmd window and other times it keeps looping and opens up multiply windows nonstop it goes crazy is there a cmd line i have to add to prevent this it running in a windows form application
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
Dim startinfo1 As New ProcessStartInfo("cmd")
[code]....
I'm making an application in school where I have to display the values of domestic, international, and total sales of company "Conway Enterprises." Everything seems to be working except it is not displaying the totalCompany sales as a currency. I'm sure it's probably an easy fix but I've been searching the internet and re-reading my book for awhile with no results. Below is the code, as I said everything seems to be working fine aside from adding the two array values and then displaying them as currency.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
[code]....
I have a program in VB.net that uses a 3D array:
Private gridList(10, 900, 900) As GridElement
Now, I just used a Memory Profiler on it (because my application is having some major leak issues or something) and apparently, this array (containing at the moment of testing 0-30 elements at one time) is using 94% of the memory currently in use by my application. Even when it is empty it takes up huge amounts of memory.
My only assumption is that even empty arrays take up space! This puts a major blow into my plans!
My Question:
Is there any alternative to this that allows me to still have the same abilities to map i.g. I've been using it like this:
Dim cGE as GridElement = gridList(3, 5, 7)
but doesn't hog up so much memory for things that aren't using memory?
I'm using a structure to hold three arrays:
structure myStruct
dim arrayOne() as char
dim arrayTwo() as char
dim arrayThree() as char
end structure
But how do I go about setting them a value, I've got my instance of myStruct
dim aStruct as new myStruct()
If I try redim, it just tells me it can't change the dimensions of an array, so how do I got about initializing the arrays with values?
I have two arrays with equals number of values, is there a way to match the values exactly in same order, as such:
FirstArray("1,"2","3","4")
SecondArray("John","Samantha","Tony","Joe")
1---John
[Code].....
i am working on a VB project for Chem and im making it for converting grams to moles, moles to molecules or any thing like that. and i have about 110 elements set up and working fine the way that im doing it but i have a feeling this is a horrible way and to abundant.
i have a textbox set up to if i type in the element He and hit enter it will find ChemElement(1)="He" and it calls "Sub DisplayElement(ByVal number As Decimal, ByRef label2 As Label)"
Which then displays the Chemical mass into a Label.
[Code]...
im a newbie here, im taking intro to programming wth VB in college and im having problem with the homework here's what im supposed to do
[Code]...
All variables and Arrays have been declared properly the problem Is when the user enters a new number using a scroll bar
LottoNumber = HScrollBar1.Value
Label2.Text = "Number Selected: " & LottoNumber
The out put of the variable count stays at 1 so the output stays at (Pick # 1 of 6) and doesnt increment at all and does not build the OutPut string
'IF The LottoNumber Location Value is 0 in the Array selectedLotto THEN mark it by making the Loacation Value to 1
If selectedLotto(LottoNumber) = 0 Then
[Code]....
Why can't I declare values for an array inside a module?
View 2 Repliesi have declared an array which i want to populate with names, as they are entered into an input box.It does not seem to work i have tried many other methods with the array but to no success.
Dim namearray() As String
Dim i As Integer
name = InputBox("Enter the candidates name:", "candidatename", "", 500, 500)
name = namearray(i)
i = i + 1
I've searched until my eyes and fingers feel as if they are going to bleed. I cannot come up with the answers I'm looking for. I want to essentially create an inventory system without using a database (part of why the eyes are bleeding, keep getting directed on side tangents), that is fed by the user. IE, User enters a name of a product, it is added in to an array. As a designer I will not know the exact number of elements to be held within the array. The user will enter their chosen item in to a text box. So I'm looking for a way to take the value in the text box and add it to the array. I believe I would use the reDIM function to do this, but beyond that I've got nothing. I'm unsure of how to reference the value stored in a text box.
View 7 RepliesI am having some major problems with byte arrays. First off the bigger array I have the more values go missing, I originally wanted to make a huge array and just dump like a 100mb chunk of memory in it but when I did that every byte in the array returned 0. So I experimented a bit and found 4kb to be the biggest chunk size to reliably not return 0.. ok I figured I'll just loop the 4kb and glue them back together later but no such luck, after being combined into the main array the bigger the number gets the more values that should be there just aren't.
Here's a code sample:
Dim retval(4095) As Byte
Dim combval(RLen) As Byte
For i = 0 To RLen - 4095 Step 4096
ReadProcessMemory(ProcAccess, i, retval, 4096, 0)
retval.CopyTo(combval, i)
Next i
WriteLine(combval(321603964))
WriteLine(ReadMemory(321603964, 1)(0))
So with the last 2 lines if I pull up some smaller number like 8 digits or so it reports back no problem but anything slightly bigger like the number i have written in there right now is just 0. After some additional research I discovered that the reason why 4kb is the max size I can reliably get is coz that's the size memory chunks are made of, "page" as they call it. Why the memory reading drops off at higher addresses alltho I suspect it has something to do with the way memory is structured and I am just not hitting the startpoint of a page anymore due to an offset or something somewhere.
Find common values in multiple arrays with PHP Pretty much does what I need, but in PHP, I need VB. My situation is I am trying to create an intelligent stock pick system based on multiple stock locations. At the point of invoicing, we loop through the items invoiced and check the stock database for available stock.
If all items on the invoice are available to pick from stock location 1, then all should be picked from stock location 1... etc. If all most items are available from stock location 1 except one or two, then pick all stock from stock location 1 except for the exceptions which should be picked from the location with the highest available stock. Finding highest available stock is simple, but I can't work out how to analyse the stock availability from multiple locations and finding the common stock locations.
[Code]...
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.
How to find a matching pair of values in two different arrays? Here's the scenario:
Index Array1 Array2
0 1 3
1 2 5
[code].....
How to get values for array elements in VB.nET from the user.also i wanted to display these values in the combo box.[this is easy i could manage this].
View 2 RepliesHow can I pass optional values to chars arrays in a function?[code]...
View 1 RepliesI have been trying to find out how to do this for days now, so I am finally asking how. I am newish to programming. Here is my problem.
I am trying to extract x,y,z coordinates from a text file arranged as such:
x,y,z
x,y,z
x,y,z
etc.
I need to be able to extract the x column into an array, the y into an array, and the z into an array. I learned how to pull it into a string, and how to split for every line, but i don't know how to split after each comma and separate them.
I am trying to use several Class arrays to hold values that I will cycle through at a later point to perform some calculations. I need to change the array sizes to fit the data as it is entered. I am using one procedure to set the first element of each array and then a separate procedure to pass the additional values as they are entered.
Until my last attempt at changing my code, my StartBalance sub seemed to work, I could step through and see the values assigned to the class arrays in the code block. However, when it moved on to the Transaction sub, it did not recognize that the first set of values were set, the array shows zero values for index 1.
I have gone through several changes trying different ideas from reading blogs and articles, but I guess I am not understanding how these work. I even used the class arrays directly instead of the Property procedures to see if I would get a different result, but I do not.
I believe I must be approaching this incorrectly and though I can find dozens of examples of setting class variables and even a couple on using arrays as class variable, I can not find any that show how to then pass values to those arrays.
Public Class Statement
Private _tranDate(1) As Date
Private _amount(1) As Double
[Code]....
I need to make basically a bunch of 2d arrays, that I can access the independant values easily. Like multiple properties As an example:
[code]...
Because later I have to access Value1 in a manner that spells out each independantly. I have used some basic Structures to define 1 property and does something with it. But not 2 properties, and I am out of my norm on creating a Class to do something like this.
I have written a ActiveX DLL in VB 6 which is like -
[Code]...
When I do this everything works fine and I am able to pass value to dll. I am passing two structures arrays and other single values like int and double etc. So far so good. But when I insert this code in another application (created in same vb.net 2005) where I actually intent it to use then i get the following error -
System.Runtime.InteropServices.SafeArrayTypeMismatchException
Specified array was not of the expected type.
I am puzzled as to why is this happening. I checked basic settings and they are same. In short the code works if i create a new project and go on but does not work and gives error if I insert in an existing application's code where i wanna use. To test I created a dll without passing structure arrays and then it worked in that application.
[Code]...
I have this code to set array values and store them in a variable,
Dim productName As String()
Dim productPrice As String()
Dim productCategory As String()
[CODE]...
How do you get the variable values to output like this?
<input type="text" value="Chang Beverages $19.00" id="Chang" /><br />
<input type="text" value="Ipoh Coffee Beverages $46.00" id="Ipoh Coffee" /><br />
<input type="text" value="Gula Malacca Condiments $19.45" id="Gula Malacca" /><br />
In this application I need to allow users to enter a month as integer (1-12) then use integer tryparse to validate that input, that seems to be the easy part. I need two create two functions, one that returns the name of the month and the other returns the number of days in that month. The arrays are supposed to be defined and initialized within the function so that the main program can take the user input and call the two functions, then return the appropriate values as output to labels. I am not sure how to declare the arrays in their appropriate functions and then how to call those functions to retrieve the right value from the function.
View 1 RepliesIn VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.
The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?
My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.
'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays
[CODE]...
I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working
View 1 Repliesthe statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "
Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"
[code]....
I was wondering if anyone knows a built in method ( LINQ say or a LAMBDA expression or other way ) that you can compare2 arrays - collections that would be valid for an equivalent 3rd array - collection which is a combination of the 1st two.
As an example consider;
* * *
A L E
[code].....
How can I sort three arrays so they are sorted together (the other two arrays are in sync with the first)?unsorted unsorted unsortedarray1]CODE]....
View 9 Replies