P prizren New member Joined Jun 23, 2009 Messages 4 Programming Experience Beginner Jun 23, 2009 #1 Hello, What is the best way to add/remove items to an integer array? Example: Dim Test() as Integer = {2,8} how do i add another item? how do i remove "8"?
Hello, What is the best way to add/remove items to an integer array? Example: Dim Test() as Integer = {2,8} how do i add another item? how do i remove "8"?
JohnH VB.NET Forum Moderator Staff member Joined Dec 17, 2005 Messages 15,828 Location Norway Programming Experience 10+ Jun 23, 2009 #2 Use a List(Of T). VB.NET: Dim ints As New List(Of Integer) ints.AddRange(New Integer() {2, 8}) ints.Add(6) ints.Remove(8) 'or ints.RemoveAt(1) Upvote 0 Downvote
Use a List(Of T). VB.NET: Dim ints As New List(Of Integer) ints.AddRange(New Integer() {2, 8}) ints.Add(6) ints.Remove(8) 'or ints.RemoveAt(1)
P prizren New member Joined Jun 23, 2009 Messages 4 Programming Experience Beginner Jun 24, 2009 #3 How do I then convert from "ints As New List(Of Integer)" to "ints() as Integer"? A function i'm using needs it as "ints() as integer". Upvote 0 Downvote
How do I then convert from "ints As New List(Of Integer)" to "ints() as Integer"? A function i'm using needs it as "ints() as integer".
JohnH VB.NET Forum Moderator Staff member Joined Dec 17, 2005 Messages 15,828 Location Norway Programming Experience 10+ Jun 24, 2009 #4 List(T).ToArray Method (System.Collections.Generic) VB.NET: ints.ToArray() Upvote 0 Downvote