i have been working on a simple program but cant get my head around it. It does not show any errors at the moment but when i run it does not do the things i would like it to do. I will paste in the code first and explain it below.
[Code]...
So basically the form has help button to show instructions, quit to quit the program and check to check whether the country from listbox lstCountries matches the correct capital in lstCapitals. The idea of the program is to shuffle the items in two arraylists and then add them to seperate listboxes called lstCountries and lstCapitals. At start i used 1 dimensional array and it worked like a charm for mixing up items in arrays and then adding them to listboxes, but then the problem had to match the correct Country with correct Capital and it only worked if i picked the items on the same index such as 1 and 1(straight line). It all sounds complicated and confusing, P.S alot of code is commented out, because i have tried many ways to make it work.
i have issue returning a list in a web method. here is the code
<WebMethod()> _ Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)() Dim context As New PPEntities
[code]....
the error is
Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'
I am using 2 dimensional arrays for my work. My problem working with them they are incredibly slow for my work. I am starting the array with randomly assigning values (non zero) to the array. Most of the array values are zeros as shown in below form (e.g. 5 x 5):
Is it possible to have a two-dimensional array/list/collection such as the following. The first dimension is to have 2 elements, 0 and 1. The second dimension I would like to be able to have a different number of elements for each of the elements in the first dimension. To explain better, I'd like X in array (0, X) to go up to say 4 and Y in array(1, Y) to only go up to say 2.
So there would be: array(0,0) array(0,1) array(0,2) array(0,3) array(0,4) array(1,0) array(1,1) array(1,2) But no array(1,3) or array(1,4).
I'd also need to be able to use Redim Preserve to increase the size of the second dimension for each of the first dimension's elements.
I need to put 2 different fields on the same line/row/subscript, into a one-dimensional array or list. I've done this before with a delimiter and then parsed it out later, but I wonder if there is a nicer way to do this?
unordered text file of 3 columns to assign into 2 arrays. I've been given a graphing component which expects a two dimensional array for a scatter graph for the set of values in the last column.
How would I parse through the list given an indexed array of 215 possible 'zone alarm locations' and if an alarm log list item, of which there can more than one for any given zone location, compare in the two dimensional array any previous value and replace it with the higher valued one? The following are my declarations for the 2 arrays. It isn't clear to me why the array for the scatter data was defined as (999,1) knowing there are only 215 possible x values (alarm zone locations)
Dim arr1 As New List(Of Double) Dim arr2 As New List(Of Object) Dim timeStart As DateTime = Now For x As Integer = 0 To 1000000
[code]....
It involves 2 lists. The first one is 1-dimensional, the second one is 2-dimensional.The first routine (which operates on the first list) completes in about .015 seconds. The second routine (which operates on the second list), however, takes almost 10 seconds. The only difference is that the second list is 2-dimensional.Is there a way to speed this up or am I doing something wrong? I have a program that requires several 2-dimensional arrays and it's running extremely slow right now. How can I speed it up so I get the same feedback that I'd get if the lists were 1-dimensional?
I have a string containing many lines. Each line has many values separated by commas. Basically it's in CSV format. The number of lines is variable but the number of columns is always 7.
I can get each line into a one dimensional array using Split(Var, Chr(10)).
I'd like to make it a two dimensional array where the second dimension contains each comma separated value.
I've got
Dim VarArray1() As String = Split(VarText, Chr(10)) Dim VaryArray2(0 To VarArray1.Length - 1, 0 To 6) As String
Is there a quick way to get the contents of VarArray1 into VarArray2. I know I can do the following.
For Counter = 0 to VarArray1.Length - 1 Dim line as string = VarArray1(Counter) Dim Values() as string = Split(line, ",") For Counter2 = 0 to 6 VarArray2(Counter,Counter2) = Values(Counter2) Next Counter2 Next Counter
But is there a quicker way to do it that doesn't require passing through each element of VarArray1 and then passing through each element of Values.
The eventual goal in all of this will be to find the highest value in the 3rd column (the arrays are strings at this point because not all columns are numeric). To do that once I get the values into VarArray2 I suspect I have to pass through each element VarArray2, i.e. VarArray2(Counter,2). Unless I can copy the whole third column into a SortedList?
I am having a problem understanding the following error message:
Value of type 1-dimensional array of string cannont be converted to 2-dimensional array of string because the array types have different numbers of dimensions This line seems to be causing the error:
New String((13) - 1) {}
I did a Google search on this but didnt come up with anything useful. I didnt even change the code.I just found this example online and copied/pasted it into a project that Im working on.
All code is listed below!
Calendar.aspx.vb Imports System Imports System.Data
The code below is used to check if the application setting, an arraylist is populated or not via the count method.
When running the program fails with error "NullReferenceException was unhandled" as initially the setting (arraylist) will contain no values.In similar circumstances I would declare a new instance of the object or set value to string.empty or check if DBNull.
I know application settings have a save method but to reference/load them one is not needed.I also left the value field in the projects -> settings to be empty.[code]...
I have a program that will compare an array of grocery list items glist and an array of coupon item clist.When I compare the two and if there is a match somewhere in the array I want to have a picturebox visible.When there is no match, I want the picture box not to be visible. [code] The code seems to work great until I come to the else statement.When the code finds a match it displays the picture box and the msgbox without error, but as soon as the message box is cleared, even though i've input it as an ELSE statement, the picturebox goes false again.Does anyone have any idea of how I can "hold" the picturebox to stay visible while the match between the arrays exists?
I developing a roster application (asp.net with VB + sql server) to let user input shift duty record, proposed screen as follows:for the database design, each staff will have one record per day.[code]I want to create a multi dimensional array to bind the gridview.Is that correct that I create a arraylist (for 7 days) and then a subarray for each day? How can I create a 7 dimensional array & sub array under this 7-D array in asp.net + VB ?
I've been working on a VB project where I use a 1st drop down list to select a movie category and then in the 2nd drop menu, movies from that category will be displayed. The movies are stored in a 2-dimensional array by category. I've been able to edit my array but I'm having problems with my .AddRange() function. What would I have to put in those parentheses for the list (for each category) to appear in my 2nd combobox when the category is selected?
I declare 2-dimensional array at class level Dim delItems(9, 9) As String The array elements are then each set to "EMPTY". I create a new form in memory Dim frm As New Form I create a new DataGridView add columns to it and add it to the new form Dim d As New DataGridView frm.Controls.Add(d)
Now the problem.....this code give error when try to load contents of 2-D array into DGV: For i As Integer = 0 To 9 d.Rows.Add() For j As Integer = 0 To 9 d.Item(i, j).Value = delItems(i, j).ToString Next Next
Error is ArgumentOutOfRangeException (Index was out of range...) When I check value of loop control variables, i = 0 and j = 1
For my programm I am supposed to store the minimum points in a five-element, one dimensional integer array name points. And I need to store the grades in a five-element, one dimensional string array named grades. These arrays should be parallel arrays. I am supposed to code the display grades button click event procedure so that it declares both arrays. It also should search the points array for the number of points entered by the user, and then display the corresponding grade from the grades array.
Here is my code: Option Explicit On Option Strict On Option Infer Off Public Class Grades Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click [Code] .....
I have an application in VBA that gives to my VB.Net dll one bi-dimensional variant. It is a an array, in which every component is a another array containing two positions.
I want to get this two-position array. When I am using VBA I can access directly the data from each position by doing:dataArray(index, 0) or dataArray(index, 1)And when I want to get the two-position array I can use:
Dim posArray as variant posArray = dataArray(index)
I have a VC++ DLL, which returns the sum of two long double values, passed as one dimensional array?l the right syntax to pass array to this dll from vb.net
currently, my code snippet is as follows: DllClass.vb Imports System Imports System.Collections.Generic
Here are the facts: Consider the following program. Sub Main()
[Code]....
Compiling the program in Visual Basic Express produces no errors. However, if the program is imported into the Excel Developer environment; I get the following error: Expected: end of statement with the equal sign highlighted. A side comment: About eight years ago, I wrote a Visual Basic simulation program to study financial trends. I found that version of Visual Basic user frendly! I find the 2010 version very difficult for doing simular projects.
i want to make a vb.net program that reads from a text file a movie, with the help of a Open Dialog (called openFD in my program) (we don't know how many movie we've got), the actors, the release date, the country, and the rating.
First question: How can I make a 2-dimensional array? line(0,0) - Movie1, ... , line (1,5) - Rating2. Here Is my try, but it's not good:
Dim line As ArrayList = New ArrayList() Dim itm As ArrayList = New ArrayList() Dim i As Integer = 0
[code]....
And here is the code for the Delete Button. It deletes a movie from the listbox, but the details of the deleted movie remains for the next one, I must delete the details for the deleted movie, too.
i'm extremely confused. my professor gave us this as the FIRST problem to do in this intro to VB class...on page 380 of our text. it is due today and i have been up all night trying to figure out where to even start. i'm so frustrated. could someone please help me and steer me in the right direction? use a one dimensional array to solve the following problem: a company pays its salespeople on a commission basis. the sales people receive $200/week, plus 9% of their gross sales for that week. for example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, a total of $650. write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assuming that each salesperson's salary is truncated to an integer amount): $200-299, $300-399, $400-499, $500-599, $600-699, $700-799, $800-899, $900-999 and over $999.
Allow the user to eanter the sales for each employee in a TextBox. The user clicks the Calculate Button to calculate the person's salary. when the user is done entering this information, clicking the Show Totals Button displays how many of the salespeople earned salaries in each of the above ranges.
I'm having trouble with this specific code and on arrays in general. This is what I am asked to do: "In this exercise, code an application that displays the number of students earning a specific score. Declare a 20-element, one-dimensional integer array named intScores with the following 20 numbers assigned to the array: (88, 72, 99, 20, 66, 95, 99, 100, 72, 88, 78, 45, 57, 89, 85, 78, 75, 88, 72, and 88). Code the procedure so that the user can enter a score from 0 to 100. Then the procedure should display using a message box the number of students who've earned that score."
First off, I do not know what I'm doing wrong with my array.. it says there's an error in line 31 saying "variable intSubscript hides a variable in an enclosing block" but I don't know what that means. And lastly, once that is sorted out, I don't know how to code a message box to appear saying how many students have received that score.
I want to put a two dimensional array into a stack and then check the stack to see if it contains the first dimension of the array. Is there any way to override the contains function to do this.