.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to create a multi dimensional array in VB .net

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
 How do I create a multi dimensional array in visual basic. For example I have a soccer team with players. Each player has an id, first name, last name, address, phone number. How would I represent this using a multi dimensional array?

View Complete Post

More Related Resource Links

How do you store multi-dimensional array to viewstate?


How do you store multi-dimensional array to viewstate?  I am having a problem.  Here's what I did:

public bool[,,] regsettings = new bool[7,5,4];

bool[,,] regsettings = (bool[,,])ViewState["regsettings"];    // this line works!

regsettings[i,j,tab] = (bool)ViewState["regsettings"]; // this line no working?! The error is: Object reference not set to an instance of an object

the letters i,j,tab are just variables in the loop.  They are there.

I also tried: (bool[,,,]) as a cast and it is a no-go either.?


how to get an array of all the asp.net textbox control inside create user wizard control?



How can I get all the textboxes inside a create user wizard control using getElementsByTagName().

Below is my JQuery code:

<script type="text/javascript">
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            } else {
                window.onload = function() {

        function prepareInputsForHints() {
            var inputs = document.getElementsByTagName("asp:TextBox");
            for (var i = 0; i < inputs.length; i++) {
                inputs[i].onfocus = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
                inputs[i].onblur = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "none";



<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

How to create an extremely large array/object (> 2 GB) without using jagged arrays ?

Hello,I had implemented a matrix scaling algorithm in Java (64-bit) for a university project and have now implemented the code in C# with .NET 3.5 64-bit. One of the operations I did in Java was creating a rectangular array with double[][] = ... (in C# this is a jagged array!) to store a symmetric matrix which is used as input for the algorithm. Since I was using matrices with n up to 30720, memory usage for the single matrix object was around 8 GB in it's maximum and with matrix multiplication around 20 GB.So... now I implemented this in C# and I am shocked to see that double[,] (rectangular arrays) can only be 2 GB in size even on 64-bit! That means that for matrices with n larger than ~15000 I will get OutOfMemory Exceptions although there is a huge amount of free memory (I have two quad core systems with 12 GB and 24 GB Ram). When I use jagged arrays in C# (i.e. double[][]) I can create larger matrices. That is because I have one small array with the size of the row number (i.e. n) and then for each row an array of size n, but they are all single objects so I don't reach the 2 GB per object limit. The problem with jagged arrays is that they are horribly slow for matrice calculations compared to rectangular arrays and even slower compared to single dimension arrays.Actually I intended to rewrite my code and simulate the matrices in single arrays (see sample code below) bec

How to create website with multi-langauge support in sharepoint 2010?

Hi Folks, I am tried to create the website with multiple Language support  in sharepoint 2010. i did not able to build the website . But I can create the website with different language at the time. kindly give me some valuable details thank you Regards Immanuel C  

Help with multi-dimensional dynamic datagrid in ASP.NET

I'm designing a web application in ASP.NET and I have the requirement of a dataset that expands in two directions.  The user can add any number of rows vertically, while scrolling through dates horizontally.  An extremely simplified version of the scenario would look something like:                           <---   9/1/2010  - -->Customer           # of orders   Total $John                         1         $10Bill                            2         $50Dave                         1         $30Mary                         5     

How to create a server control array


Let's say I have 50 different SQL SELECT statements which each one returns one integer value...

e.g. SQL 1 = select count(row) from table where condition = 'a'

      SQL 2 = select count(row) from table where condition = 'b'

      .....  so on  .....

      SQL 50 = select count(row) from table where condition = 'zzz'


If I have 50 labels (server control) and want to put each SELECT result to corresponding labels by using a FOR LOOP.


      for (int i=0; i<49; i++)


            // connect to the database and run each SELECT statement

            // store each result to corresponding label.  (Result 1 -> Label 1, Result 2 -> Label 2, .........., Result 50 -> Label 50)



I have all 50 SQL SELECT statements to run in a loop and each one has the result that I want.

I need to display all 50 results in 50 different labels (one-to-one) and just don't know how I need to name each label, so that I can use them like a array.


In VB6 (back in th

How to create an array of VB.net objects from a VB .net class


I need to create an array of a class type. Populate the values in the class and then pass
the array to a subroutine. I havent figured out how to do this properly as I get a null
reference exception. Can someone show me how to create/instantiate the array of objects?
Here is a simple example with only one property named "_momentum". My actuall class has about
10 properties/variables in actuality

Public Class Torsion

 Dim _momentum As integer

 Public Property Momentum
            Return _momentum
    End Get
    Set(ByVal As Integer)
      _momentum = value
End Propterty

' Later in the code I try to create and object of the class

Dim x(0) As Torsion

Creating a One-Dimensional Array for use with AddUsersToRoles Method


Dear All

I've created an Excel spreadsheet for my users to upload into my web application to bulk import  memberships and roles into the application. There are up to 4 different roles which users can be members of so I'm using AddUsersToRoles to add the user to one or more roles in one line of code like this:

r.AddUsersToRoles(usernames, CreateListOfRoles(Role1, Role2, Role3, Role4))

As this line of code expects a one-dimensional array of roles, I have created a function to take in the roles from my spreadsheet, add them into a one-dimensional array, and return that to the AddUsersToRoles method. The CreateListOfRoles function looks like this:

    Function CreateListOfRoles(ByVal Role1 As String, ByVal Role2 As String, ByVal Role3 As String, ByVal Role4 As String) As Array

        Dim ar As New ArrayList

        'If the role boxes are not blank, add them to the array
        If Not String.IsNullOrEmpty(Role1) Then
        End If

        If Not String.IsNullOrEmpty(Role2) Then
        End If

        If Not String.IsNullOrEmpty(Role3) Then
        End If

        If Not String.IsNullOrEmpty(Role4) Then
        End If


multi dimensional arrays???


I have the following code in which I pass 1 value in the array after comparing 2 data tables.

Now how do I pass all the values from the data tables rows (like docfiletype, docseqid) in one array(or should I use something else)? so that I can sort the array based on docseqid?


Dim ls_attachment_filename() As String = Nothing
 Dim li_attachment_count As Integer
Dim j As Integer
For j = 0 To leadrowcount - 1

                        Dim docidatt As String = recordDatatable.Rows(j).Item(0).ToString
                        Dim docredid As String = recordDatatable.Rows(j).Item(1).ToString
                        Dim docfiletype As String = recordDatatable.Rows(j).Item(2).ToString
                        Dim docsize As String = recordDatatable.Rows(j).Item(3).ToString
                        Dim docseqid As String = recordDatatable.Rows(j).Item(4).ToString
                        Dim k As Integer
                        For k = 0 To rowcasecount - 1
                            Dim caseidatt As String = caseDatatable.Rows(k).Item(0).ToString
                            Dim caseredid As String = caseDatatable.Rows(k).Item(1).ToString
                            Dim casefiletype As String = caseDatatable.Rows(k).Item(2).ToString
                            Dim casesize As String = caseDatatable

Create array in custom code


I have a parameter that displays a drop down list of values that the user can select from. The parameter displays the description, but the sql table is keyed by a code value, that I don't  want to show the user, I though about building an arrary of code values in the custom code, but since I can't reference a data set inside the custom code, what would be the best way to build an array or is there a better way of showing the description but hide the code value from the user.




Daniel J. Plocica

How to create a wpf tree with multi-level hierarchy where the children are of the same type as the p


I have a structure of objects as below, where the child elements are of the same type as their parent.  The parent might also contain child elements of different type(s).

My object structure:

Main Site

Main Site

Sub Site

Sub Site

Sub Site


How to create Drop down list with multi select capabilty.


Hi All,

I want to create a multi selected drop down list using ASP.NET MVC 2.

Can anyone guide me.

How do i achieve it.

Please Help.

what are relational and multi-dimensional format?

I read an interview question:
"In which format SSAS stores data?"

Well, I remeber having read, that ROLAP stores and operates their data and metadata in  relational format (OLTP relational database) that permits to use SQL, above of only MDX for SSAS storage.

What are exactly relational  and multi-dimensional (SSAS) formats?
What are details of their storage, resp., and what are the differences? 

c# code to create an array of parameters for oracle stored procedure



Working on a c# project that has oracle as backend.  I have problem creating a function in my codebehind page to create an array of paramenters for oracle stored procedure. for example i have the follwoing code for ms sql server...

SqlParameter[] parm = 


                         DataCon.createSqlParameter ("@id", DataCon.DBNullIfBlank(txtid.Text.ToString()), SqlDbType.Char,9 ) ,

                         DataCon.createSqlParameter ("@FName", DataCon.DBNullIfBlank(txtFName.Text.ToString()), SqlDbType.VarChar,14),

                         DataCon.createSqlParameter ("@MI", DataCon.DBNullIfBlank(txtMI.Text.ToString()), SqlDbType.Char,1),


 For the same in oracle I am using the followin

How to create a multi-stage workflow in SharePoint Designer 2007


Hello everyone,

I'm new at creating workflows and have only created a very basic one. I was handed a task and creating the following workflow and I have no ideal on what to do.

Here is what they want to happen.

 The user submitts the form and depending on what he chooses in the Segement Report Access field will determine on who it goes too. The user can choose multiple options. The options are our 4 divisons. Each division has one approver assigned to it. We created a list for this and then in the form it's a look up value.


The user choose two of the four options. (Sheet and Color) So the workflow needs to send and e-mail to the Sheet user to approve the request and it needs to send another e-mail to the Color user to approve the request. Now if they both reject it, the workflow would stop and send a message to the user saying your request has been rejected. But if one user approves it and the other one rejects it, it needs to go to the next step, which would be sending an e-mail to the user who sets up the account. They want him to be able to see which parts were approved and which parts were not approved.

Once he's setup then we need to send an e-mail to the requester saying that it's been approved.

Sorry if they is long, I just have no ideal where to start or how to start this.



Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

How to create 3 tier application using LINQ

As you know that in 3 tier architecture there are three layers

User interface layer. (Is our Form in Windows application and .aspx page in Web application)
Data Access layer. (Which provides interface between Business logic layer and Database)
Business Logic layer.(Which stores your application logic)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend