ArrayList Vs Array Of Strings?
Mar 7, 2009
If I want to store a list of names ie. "David", "Frank", "Chris", would it be better to do:
[Code]...
Also, what is the difference if you put the () with the variable name or with the type? I see sometimes
[Code]...
View 6 Replies
ADVERTISEMENT
Mar 20, 2012
I 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?
View 6 Replies
Jan 6, 2009
I'm having trouble using an arraylist with an object. [code] The arraylist Phrase gets populated with 4 objects (WordObject) filled with the word "Fox".The arraylist AnotherPhrase gets populated with strings "The", "Quick", "Brown", "Fox".Why does the Phrase Arraylist do that? Shouldn't there be 4 objects each with different words?
View 3 Replies
Dec 22, 2011
I was wondering if there is a way to get an arraylist returned from strings.split as opposed to a 1-D array. I can't seem to find how to do it.
View 1 Replies
Dec 18, 2010
Speed is critical in my application. As of now, I'm using an ArrayList to store a list of Strings and I use BinarySearch functionality of ArrayLists to search for an item. Would I be able to do this faster using String Collection and a for loop?
View 22 Replies
Oct 16, 2009
I'm migrating from VB6 to VB.NET, in hence my questions below:
I have to write a function that returns array of strings.
How can I initiate it to empty array? I need it since I have to check if it's empty array after it returns from this function.
Is list of arrays better for this purpose? If I use a list - Is it empty when it firstly defined? How can I check it it's empty?
View 3 Replies
Jun 24, 2011
Dim str As String
Dim str2 As Array
str = "blabla duhduh"
str2 = str.Split(" ")
View 2 Replies
Nov 9, 2010
After gathering the Machine names on the (sealed) LAn i am then getting the ip addresses, MAc address and Macine User name of each machine on the LAn..These details will need to be accessed seperately for use in the security testing and i am unsure how best to store the active data (though eventually in a database) Am i best to create a Multidimensinal arrayList or array(bearing in mind that all the data is convereted to "String" (arrays can only store one data type??) The data found on the live network is allways changing making an array a difficult choice? I have read some tutorials mentioning making a structure with the data and storing this in an arraylist but i dont know whether this will make accessing the individual data items (ip,MAc,HostName etc) a difficult procedure?
View 1 Replies
Jun 7, 2011
Dim iArr As Array For Each iArr In m_alTabell 'ReDim myArr(16, 11) If i dim iArr(0,0) as string I could do this.ii = ii + 1 iArr(i, constanter.colNames.colValue) =m_objList.GroupItems.Item(ii).ListItems(i).Value'm_alTabell.RemoveAt(ii - 1)'m_alTabell.Add(iArr)
[Code]...
I have a problem with this code. m_alTabell constists of 10 twodimensional arrays. I have some data in them from the beginning. Now I want to add data in each iArr in a_alTabell. This works fine on the first one. But then the trouble starts. It just keeps overwriting the first iArr in m_alTabell. So if i could redim iArr it would solve the problem but i cant do that course it needs to be declared as Array and not "Dim iArr(0,0) as string" since that couses other problems.
View 11 Replies
Jun 18, 2012
Here's my code
Dim allelementds As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
For Each DD As HtmlElement In allelementds
If DD.OuterHtml.Contains("resource") Then
TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))
[code]....
As you can see im currently using a combobox as a type of a list which uses index to give certain labels their text I know that there are only 4 indexes when getting the inner text so how can put those 4 indexes into a sort of list without me using a Combobox?
View 3 Replies
Feb 17, 2012
I want to save some strings in a Session("myKey") as an ArrayList in my asp.net application.
So I have somthing like that:
Dim s As String = "String1"
If I use
Session("myKey") = s
it is working for the moment.
After PostBack I want to add another string to the session.
If do the same thing again, then i will overwrite my Sessiondata.
So I'm searching for something like this:
Dim s As String = "String1"
TryCast(Session("myKey"), ArrayList).Add(s)
In this case the Sessiondata would be stored correctly, but my code is not correct.
View 1 Replies
Feb 27, 2012
I have an array of String and I have to convert it to an ArrayList. Is it possible to do it in VB.Net?
View 1 Replies
May 6, 2010
how to convert an array of strings to an array of integers? I want to convert a string array with 77, all string numbers, to an integer array?
View 1 Replies
May 12, 2011
i have 2 string arrays and I want to merge them together then put the elements into a third string array ..
for an example :
string1="a","b","c"
string2="d","e","f"
after merging:
string3="a","b","c","d","e","f"
View 2 Replies
Jun 23, 2009
Is an ArrayList the same thing as a Structure (i.e. 'array of records')? If they're not the same think, what't the difference?
View 3 Replies
Feb 9, 2011
I have an array list on my server side that i want to use on my client side as an array how can i do this.
View 1 Replies
Jun 29, 2010
I am trying to split an array into a jagged array for easy manipulation, but I am having a bit of trouble with the Copy method of Array.This is what I have:
Dim masterData()() As String = New String(splitCounter.Count - 1)() {}
For i As Integer = splitCounter(0) To splitCounter.LastIndexOf(splitCounter)
Array.Copy(ServerResponse, splitCounter(i), masterData(i) = New String(), i, splitCounter(i
[code]....
View 2 Replies
Mar 13, 2012
there are any nifty in-built .net methods that can essentially return either the number of occurrences of each element in an array, or simply return the modal value.
View 7 Replies
Apr 22, 2010
I have a list of names in a database and what i want is to get all of these names and display them in a label or a text box to the user on the website. I have tried to do this using a for loop but it is always overwriting the label each time. I have a list of 10 different names in the database and what it is doing is putting the first name in the label and then overwriting this with the second name and so on until it reaches the last name. I think i need to store each of the names from the database into an array or an arrayList and then make the label display all of the contents from the array or arrayList. The for loop i have used for this is:
Dim g As SQLadmin = New SQLadmin()
g.DB("SELECT nameOfPerson FROM Persons")
For i As Integer = 0 To g.array.GetLength(0) - 1
[code]....
i can select the names from the database and store them in an array then make the label display each of the names.
View 6 Replies
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
Dec 1, 2011
What I am doing is iterating through all the groups that belong to the top group (Generic reports). Then I take advantage of the GroupPrincipal.GetMembers(True) which will recurse through a given group name. I test to see if the user exits under that group and if true I put the group name in an arraylist.
I use the for each principal in GroupPrincipal.GetMembers to loop through each returned user to see if they exist.
Is there a way to put all the returned users Principal.Name from a given group in GroupPrincipal.GetMembers into an ArrayList? This would allow me to to use Arraylist1.IndexOf to search for user. Which would be much faster then iterating through a returned list using the for each construct.
Sub RetAllMbrs(strUser As String)
Dim oPC As PrincipalContext = GetPrincipalContext() '<- this is function somewhere else in the code
[Code].....
View 1 Replies
Jan 11, 2012
I have a problem in Treading.I have a code like this;[code].....
I want to change ListBox1 with ArrayList. But I couldn't find how to use adding a string to ArrayList in tread.
View 5 Replies
Mar 21, 2012
ok so i have a .txt file that is a log of events. they pretty much follow this format:
[Code]...
View 15 Replies
Jun 8, 2011
The problem I'm having is that it seems like strings have to be initialized differently than other types and I don't know what I'm doing wrong.
Public Class Class1
Private intNum() As Integer
Private dateString() As String
[code].....
View 7 Replies
Dec 25, 2009
What's the easiest way to join an array of strings?
View 3 Replies
May 30, 2009
Why does the following not work below? I get an error on the first bracket "{" saying "Expression Expected"[code]...
View 2 Replies
Jan 13, 2011
Is there a way to sort an array in VB that would put J10 and J11 after J9?
J1 (PN= 605848)
J10 (PN= 605987)
J11 (PN= 605987)
[code].....
This is what I get after I run myArray.sort()
View 1 Replies
Mar 31, 2012
Each array string represents a text file in a folder. I want the array to be sorted based on what the text file contains. How would I do that?
View 1 Replies
Apr 3, 2009
What is the best way to clear an array of strings?
View 4 Replies
May 14, 2011
I am creating a Simple Publisher Application in which I need to insert texts in different textbox from an array of strings .I have coded it like this .
Dim texts(40) As String 'Array of strings to be inserted
shpTextBox = appPub.ActiveDocument.Pages(pageIndex).Shapes.AddTextbox _
(Orientation:=PbTextOrientation.pbTextOrientationHorizontal, _[code]......
Now It only populates first text box with the first string in the array (For 0th index) and rest textboxes contains empty strings ,though texts array has values.
View 1 Replies