[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


vb.net arrays

Posted on 2004-11-10
Medium Priority
Last Modified: 2010-04-23
I am new at VB.net and I have to creat arrays for the descriptions I wan to display on a screen. For example
"First Name"
"Phone Number"
then I will pull the data to show up beside them.  Can anyone give me an example how to create an array for these descriptions.  I don't know how to create an array.

Question by:lindapat
  • 2
LVL 27

Expert Comment

ID: 12547315
sample code

Public Class frmArrList
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()

        'This call is required by the Windows Form Designer.

        'Add any initialization after the InitializeComponent() call
    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
            End If
        End If
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
        Me.Text = "frmArrList"
    End Sub

#End Region

    Private Sub Test()
        Dim str As String = "John Doe, 1000 UptheStreet Drive, 145-423-9875"
        Dim strarr() As String

        strarr = str.Split(",")
        Dim sText As String
        Dim i As Integer
        Dim myAL As New ArrayList

        For i = LBound(strarr) To UBound(strarr)

        sText = "First Name= " & strarr(0) & vbNewLine
        sText += "Address= " & strarr(1) & vbNewLine
        sText += "Phone Number= " & strarr(2) & vbNewLine

    End Sub
End Class
LVL 27

Accepted Solution

planocz earned 2000 total points
ID: 12547391
the myAl is the ArrayList function in Micro$oft

change code to ...

        sText = "First Name= " & myAL(0) & vbNewLine
        sText += "Address= " & myAL(1) & vbNewLine
        sText += "Phone Number= " & myAL(2) & vbNewLine

Author Comment

ID: 12565964
Thank you sooooooo much. You have been a life saver.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 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