Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.Net Arrays

Posted on 2004-09-08
4
Medium Priority
?
234 Views
Last Modified: 2010-04-23
Hello, How do I clear a certain element in an array.

E.g.

      Dim myIntArray(1, 2) As String

        myIntArray(0, 0) = "One"
        myIntArray(0, 1) = "Two"
        myIntArray(0, 2) = "Three"
        myIntArray(1, 0) = "One One"
        myIntArray(1, 1) = "Two Two"
        myIntArray(1, 2) = "Three Three"


I want to clear the element where the text says "Two Two".

        Array.Clear(myIntArray, x, y)

What will x and y be and why..?

Thanks
0
Comment
Question by:sublimation
4 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 12005959
Have you thought about using the ArrayList?
0
 
LVL 18

Accepted Solution

by:
deighton earned 1000 total points
ID: 12005978
myIntArray.Clear(myIntArray, 4, 1)

its element index 4, zero based, so its the fifth element
0
 
LVL 4

Author Comment

by:sublimation
ID: 12006059
Hello, deighton.  

That seems to work well, can you tell me where the argument 1 comes into it please?

0
 
LVL 8

Assisted Solution

by:bramsquad
bramsquad earned 400 total points
ID: 12006105
y = 1 becuase its the length of how many to clear

if y = 2 then both (1, 1) and (1, 2) would clear

~b
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question