GeekInterview.com
Series: Subject: Topic:
Question: 68 of 416

VB.NET 2-dimensional array

How do you search within a 2-dimensional array using VB.NET? How can I know that a value already exists in the array?
Asked by: Myra13 | Member Since Nov-2007 | Asked on: Nov 5th, 2007

View all questions by Myra13

Showing Answers 1 - 2 of 2 Answers

Dim arr(1, 2) As String       arr(0, 0) = "Sandip"       arr(0, 1) = "India"       arr(1, 0) = "Jon Doe"       arr(1, 1) = "US"       Console.WriteLine(arr.GetUpperBound(0).ToString())       Console.WriteLine(arr.GetUpperBound(1).ToString())

  
Login to rate this answer.
Andoulla

Answered On : Nov 12th, 2012

View all answers by Andoulla

Use two for loops.
one for the columns and one for the rows.
exit for as soon as you find the value (preferably return true that you found the value)

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.