Passing ArrayLists Between Subroutines?

Jun 2, 2009

I am trying to convert an algorithm to use them in order to save memory. However, I am struggling to achieve error-free code while using "Strict On".

Here is a basic version of the code I am attempting to use.

Code:
Option Explicit On
Option Strict On
Module Program

[Code]...

It works when I do not use the Strict option. How do I improve the code to compile error-free?

View 4 Replies


ADVERTISEMENT

Interface And Graphics :: Passing Bitmaps & Graphics To Subroutines As Arguments

Jan 22, 2011

I used to program with Visual Basic 6, so I have alot of old programs that I'm updating, plus I'm learning the new VB2008 methods. I'm writing a program that replaces the old "BitBlit" function which is no longer supported by Visual Basic 2008. It involves three picture boxes, one holds the sprite bitmap, a second holds the mask (silhouette) of the sprite bitmap, and a third has a background image.

[Code]...

View 3 Replies

.net - Get The Difference Of Two Arraylists?

Jul 2, 2010

I have two arraylists, and I would like to have a new arraylist with only the uncommon items. Is this the "best" or at least decent way to do it?

[Code]...

View 2 Replies

For Each Loop In Arraylists?

Jun 23, 2012

OK, so I am creating a bit of code that will allow me to randomly pick one "card" from a "deck", delete that "card" from the deck, and repeat. I found in all of my research that vb.net has the arraylist that is supposed to be very simple in these situations. However, when I try to populate them with a For Each statement, I only get odd numbers in the array list. What am I missing?

Dim a As New ArrayList
For i As Integer = 1 To 52
a.Add(i)

[code].....

View 5 Replies

Iterating Through 2 Arraylists?

Jan 5, 2010

I have two arraylists that contains links in one and the root url in the other. Sometimes the lists dont equal in number and I would like to iterate through the links list and if it contains a matching root url add it to a third list but also avoid any duplicates. I tried this but am not getting consistent results.

For Each link As String In urls
For Each part As String In post
If part.Contains(link) Then

[code]....

Perhaps there is another way; basically the part in post is a link to a page and contains the root url( which is link in urls). After extracting all these I need to ensure the 2 lists match.

View 7 Replies

Use ArrayLists With My.Settings?

Mar 1, 2009

I was trying to use ArrayLists with My.Settings but I can't seem to figure out how to get them to work.If I make a setting called "Words" and make it an ArrayList without a value, the program has an error every time I try to run it. If I try to give it a value in the project properties window it always gives me an incorrect data type error. Besides, I don't want it to have a value, I want it to be blank such as when declaring a New ArrayList. The only way I can get an ArrayList My.Setting to work is by clicking in the Value box, clicking the "..." button in the corner and adding some kind of Object with the add button. This automatically puts some kind of wierd object in the first index of the array list. If I don't convert Item(0) of the arraylist to a string then it also gives me an error when I try to read it. As a string it comes up as System.Object. Even though I can use the my.settings.Words ArrayList with an object in the first index, how can I get the setting to start off blank without having to constantly avoid the first index?

View 10 Replies

Use List(Of T) In VB Instead Of ArrayLists?

Jan 30, 2011

I have been tempted to use List(Of T) in VB.NET instead of ArrayLists by someone-who-must-not-be-named-Robinson.Essentially, what I need to store are three things: One string, two integers, and maybe two booleans. I liked using ArrayList, because it treated all its elements as "Objects" so I didn't really have problems storing that variety of elements.But now I have been thinking on using List(Of T). But how do I do to store that variety of elements of mine? I have been thinking on making a Structure holding the five elements.Sounds like a good idea? I heard somewhere that Structures are expected to have a short life. But I fear I will be having my structures for... forever, as long as my app lives. That makes any difference? Finally, what if I needed to create... dunno...... 125000000 Lists, each containing a structure? Is that possible (and good)?

View 2 Replies

.net - Compare Two String ArrayLists?

Oct 7, 2010

I have two array lists

dim Colors1 = New ArrayList
Colors1.Add("Blue")
Colors1.Add("Red")

[code]....

I would like to find out which colors are missing from Colors2 that are found in Colors1

View 2 Replies

Combine Multiple VB Arraylists Into One?

Sep 8, 2010

I have three arraylists (datasets and subsets) that I need to combine into one arrraylist so I can databind it to a repeater control and then present data to the user. As far as I know, you can only bind the repeater with one datasource (please correct me if this is wrong) that's why I'm combining these arraylists.Each arraylist has an ID from the database which I can use as a datakey to keep the data aligned. How do I combine these lists?

View 4 Replies

Find Duplicates In Two Arraylists?

Oct 28, 2011

I have searched high and low for a solution yet still no luck, I have two arraylists populate with FileInfo and I want to compare the two and write the duplicate (matching files) to a listbox.Here is how I have populated the arraylists but in terms of the comparison I have not found anything that works:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arraylist1 As ArrayList
Dim arraylist2 As ArrayList

[code]....

What can I do next to compare the two and write the duplicates to ListBox1.

View 5 Replies

Iterating Throught 2 Arraylists?

Jan 5, 2010

I have two arraylists that contains links in one and the root url in the other. Sometimes the lists dont equal in number and I would like to iterate through the links list and if it contains a matching root url add it to a third list but also avoid any duplicates. I tried this but am not getting consistent results.

[Code]...

View 2 Replies

Arraylists Output Not Writing To .txt File?

Jan 30, 2010

Background: I'm writing a application that will allow users to enters items on a form using textboxes, radio buttons and checkboxes. I then take each input item and write it to it's own arraylist. After the user is all done entering data the information in the arraylists will write out to a single .txt file.

View 6 Replies

Iterating Through Arraylists - Not Getting Consistent Results

Jan 5, 2010

I have two arraylists that contains links in one and the root url in the other. Sometimes the lists dont equal in number and I would like to iterate through the links list and if it contains a matching root url add it to a third list but also avoid any duplicates. I tried this but am not getting consistent results.

[Code]....

View 2 Replies

Sorting Multiple ArrayLists Alphabetically

Sep 26, 2011

I've got three arraylists of strings, and the "091: " part of the string is not part in the arraylist, thats added when I display them in the listboxes. So basically, how can I sort a list, and make sure that item nr 98 in english, still equals nr 98 in japanese and kanji?

View 11 Replies

What Is This List Of Objects (arrayLists) Being Cleared?

Jul 12, 2011

I am obviously not understanding something about scoping that is very basic. I have a very simple class:

Public Class testListClass
' This just contains a single list that is set by a property or the constructor
Private classArrayList As New ArrayList()

[code].....

View 5 Replies

String Splitting - Name1, Name2, And Name3 In 3 Seperate Lists, Or Arraylists?

Jul 1, 2010

I did this before, but i totally forgot how to do it.I have an array, the array contains strings with 2 seperators.like so:

name1 / name2 / name3

Basicly i want name1, name2, and name3 in 3 seperate lists, or arraylists. But, i don't know how to do it.Each line is being read from a file.

View 15 Replies

Added Three Subroutines To A Form?

Oct 30, 2009

I recently added three subroutines to a form, and as a result of adding only the three subroutines, I have noticed some weird behavior in the form and I can't pin down why these three subroutines would cause it.

View 16 Replies

Dynamically Generate Subroutines?

Mar 20, 2010

To detect 'death of player' I am using the mouseleave event of my picturebox background (background1). Unfortunately this triggers both when the mouse enters an 'evil' and the 'points' and ends the game without the player being able to collect points.

The obvious way to solve this would be to swap detection to entering evils.

Unfortunately I am dynamically creating my 'evils' and do not know how to also dynamically create subs to deal with MouseEnter. Here is my code for generating the 'evils'

'The number of evils (asteroids)
Dim evilcount As Integer
'A count for use with comparison to evilcount

[Code]....

View 2 Replies

Event Interferes With Subroutines

Dec 14, 2009

I'm struggling with an event related to my communications class.I'm calling a 'DataChange' function via event handler any time I receive new data over my serial connection. I then proceed to load that data into a DataGridView, perform some formatting, etc for the users. I'm getting a ton of problems due to the frequency at which the DataChange event is called and seems to steal the focus out of othert subroutines and functions mid-process.For example, I'll attempt to transmit data back to the serial device. After I format the data, but before I can actually call the Send function from my library the focus is directed back to DataChange and I never actually transmit my data.

Is this a problem best addressed by threading the DataChange related routines, unhooking the DataChange event before a function or routine then rehooking, or is there some basic principle I'm not implementing.

View 2 Replies

Hide Subroutines/Outline

Feb 5, 2009

The Visual developer express outline provides hide/plus-minus signs throughout the HTML code, and it does this for Class's, but not for my subroutines in an ASPX file.Is there a way for it to do this, so I can reduce subroutines I'm not working on at the moment? I know I can highlight areas and hide, but it's kind of clunky to do quickly through many subroutines if I have 2k lines and a hundred subroutines.

View 1 Replies

How To Pass Array Between Two Subroutines

Feb 4, 2011

I have 2 arrays X(n) and Y(n) where n can vary programmatically, no set value. I want to pass these two arrays between two subroutines.

Sub sub1()
...
call sub2(X,Y,n)
end sub
sub sub2(x,y,n)
...
end sub

I want to know how to prepare the arrays for the "call sub2" and how to extract the arrays in "sub2".

View 5 Replies

Managing Multiple Subroutines?

Feb 25, 2009

have been writing code to replace an old Fortran program. The Fortran program had very organized subroutines which could be called from anywhere in the project. Most of these were relatively small and left a small, easily followed main routine. I'm converting over to VB.net and when I write the subroutines they are all on the same form. Wading through 50-100 subroutines on one form is going to be messy.

View 3 Replies

Send Data Between Subroutines?

Apr 22, 2011

I would like to send the variable "dst" from the Combobox1 sub to the Data sub. [code]...

View 1 Replies

Delegates - Calling Subroutines From Lambda In .net?

Oct 7, 2009

I find myself calling functions from lambdas frequently as the provided delegate does not match or does not have sufficient parameters. It is irritating that I cannot do lambda on subroutines. Each time I want to do this I have to wrap my subroutine in a function which returns nothing. Not pretty, but it works.

Is there another way of doing this that makes this smoother/prettier? I have read that this whole lambda inadequacy will probably be fixed in VS2010/VB10 so my question is more out of curiosity.

[Code]...

View 2 Replies

Programming With Excel: How To Call Other Subroutines In The Right Way

Dec 21, 2011

am developing an application automatingExcel 2011 from Visual Studio2010 with Visualasicthe problemis that I can call other subroutines.I developed the following subroutine to addformatting to the selected ce

View 3 Replies

Screen Elements And Sequential Subroutines

May 22, 2011

Working on my major project for my last year of school worth 30% and am having issues with getting screen elements (buttons, labels, picture boxes, etc.) to update before or during a sequential sub program or function.

For example, I have a series of picture boxes that require to be clicked on to activate certain commands. Here is the code for one of the picture boxes, picX3Y0, when it has been clicked on:

If picX3Y0.ImageLocation <> imageFolder + hiddenImages(3, 0) + ".png" And imagesSelected < 2 Then
If x1 = -1 Then
x1 = 3

[Code].....

View 4 Replies

Sending Excel Objects To Subroutines

Dec 14, 2011

As it is right now I have a bit of code that kind of looks like this (a little paraphrased but Im sure you get the idea)[code]I thought for sure the above would work but it still seems that I am missing something, when I open the excel sheet nothing was printed. This would cut down the lines of code that I have in half easily, so I would love to find a solution for this [code]But the excel sheets still do not update with the new information.

View 1 Replies

VS 2010 Sending Array Between Subroutines?

Dec 10, 2010

I'm having trouble with passing an array between subroutines

I have an array called "lines" which is loaded from a text file and then edited according to a series of checkboxes within one subroutine. Each line in the array is essentially a line from the text file

I then need this array passed to another routine so that it saves to a new text file once the save button is pressed. (in this case just the top 5 lines)

At the end of the section that creates the array i have placed this

From File Edit
Call Savefile(Lines)

The section of code below is from the section once the button is pressed

Save Code
Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Savebutton.Click

[Code].....

View 3 Replies

Writing Shared Subroutines In A Class?

Dec 8, 2009

AdamSpeight2008, on 19 Jul, 2008 - 10:50 AM, said:Labels You have a label on a form and If you're using Label1.Caption = "Text for label" it's VB6 If you're using Label1.Text= "Text for label" it's VB.Net Buttons You have a button on a form. To set the text on the button.You're using Button.Caption= "Text on button" it's VB6 You're using Button.Text="Text on button" it's VB.Net

View 2 Replies

Open A Form As Invisible And Be Able To Still Call Subroutines From It?

May 17, 2011

1. If i have 2 projects in the same solution, how do i use one to open the other?

2. How would I open a form as Invisible and be able to still call subroutines from it?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved