help in creating array RRS feed

  • Question

  • User1280950372 posted

    What am I doing wrong in the following code? On the comma of the first element of each of the array lists, error detection indicates

    ')' expression expected

        Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender Dim varLabelName, varLabelText As Object
    lbl As Label

            'create arrays
            varLabelName() =("lblGradYrView", "lblCityView", "lblStateView", "lblZipView", "lblPhoneView", "lblCellView", "lblGenderView", "lblMaidenNameView", "lblSpouseNameView", "lblWorkActView", "lblPosterityView", "lblHobbiesView", "lblBirthMoView", "lblBirthDayView", "lblOtherView")
            varLabelText() = ("Profile.GradYr", "Profile.City", "Profile.State", "Profile.Zip", "Profile.Phone", "Profile.Cell", "Profile.Gender", "Profile.MaidenName", "Profile.SpouseName", "Profile.WorkAct", "Profile.Posterity", "Profile.Hobbies", "Profile.BirthMo", "Profile.BirthDay", "Profile.Other")
            Dim intCnt As Integer
            'iterate arrays

            For intCnt = 0 To UBound(varLabelName)
                lbl = ControlUtilities.FindChild(lsvEditProfile, varLabelName())
                lbl.Text = varLabelText(intCnt)
            Next intCnt

        End Sub

    Wednesday, September 17, 2008 5:44 PM

All replies

  • User-808362359 posted
    I use to work on C# and havn't worked on VB.NET yet. So I searched the web and found this helpful. Probably, this should be done in the following way:
    Dim Test() as Integer
    Test=New Integer(){1,3,5,7,9,}

    For more details, view: http://www.startvbdotnet.com/language/arrays.aspx
    Thursday, September 18, 2008 2:34 AM