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

x
?
Solved

vb.net arrays

Posted on 2004-11-10
3
Medium Priority
?
263 Views
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"
"Address"
"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.

Thanks,
0
Comment
Question by:lindapat
  • 2
3 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 12547315
sample code


Public Class frmArrList
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        Test()
    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
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    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)
            myAL.Add(strarr(i))
        Next

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

    End Sub
End Class
0
 
LVL 27

Accepted Solution

by:
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
0
 

Author Comment

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

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