Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,851 questions

51,772 answers

573 users

How to create and initialize a 2d array of characters with different row lengths in VB.NET

1 Answer

0 votes
Imports System
 
Public Class Create2DArrayOfCharactersWithDifferentRowLengths
    Public Shared Sub Main()
        Dim jaggedArray As Char()() = New Char(2)() {}
            jaggedArray(0) = New Char() {"V"c, "B"c}
            jaggedArray(1) = New Char() {"p"c, "r"c, "o"c, "g"c, "r"c, "a"c, "m"c, "m"c, "i"c, "n"c, "g"c}
            jaggedArray(2) = New Char() {"l"c, "a"c, "n"c, "g"c, "u"c, "a"c, "g"c, "e"c}
 
       	Dim rows As Integer = jaggedArray.Length

        For i As Integer = 0 To rows - 1
            For j As Integer = 0 To jaggedArray(i).Length - 1
                Console.Write(jaggedArray(i)(j) & " ")
           	Next
            Console.WriteLine()
        Next
    End Sub
End Class


' run:
'
' V B 
' p r o g r a m m i n g 
' l a n g u a g e 
'

 



answered Feb 7, 2025 by avibootz
edited Feb 7, 2025 by avibootz
...