End of Statement Expected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aussie1333
    New Member
    • Apr 2010
    • 3

    End of Statement Expected

    Hey guys, I'm in high school, and just for a little personal project, I was trying to write a program, and I've got it pretty much downpat, but after the line "Dim lstPizza(8).Ite ms" within this sub:
    "Private Sub fmPizza_Load(By Val sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    Dim lstPizza(8).Ite ms
    End Sub" it comes up with "End of Statement Expected". I have chatted to my teacher, but he is unsure what to do about it. What should I do???
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Originally posted by Aussie1333
    Hey guys, I'm in high school, and just for a little personal project, I was trying to write a program, and I've got it pretty much downpat, but after the line "Dim lstPizza(8).Ite ms" within this sub:
    "Private Sub fmPizza_Load(By Val sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    Dim lstPizza(8).Ite ms
    End Sub" it comes up with "End of Statement Expected". I have chatted to my teacher, but he is unsure what to do about it. What should I do???
    dear,

    Is this vb6 or vb.net ????

    br,

    Comment

    • semomaniz
      Recognized Expert New Member
      • Oct 2007
      • 210

      #3
      Dim lstPizza(8).Ite ms is this even valid ? What are you trying to declare?

      Read Below



      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        dear,

        I have never seen a Dim in vb6 with points !!!
        If you want to dim a array then (like in your URL) =>

        Code:
        Public Sub LongTask(ByVal Duration As Single, _
                             ByVal MinimumInterval As Single)
           Dim Threshold As Single
           Dim Start As Single
           Dim blnCancel As Boolean
        An array is =>

        Code:
        Dim MyArray(8) as integer
        When you dimension a var then VB6 gives a list of the possibilities (see attached as...JPG.
        And a red colored line if the syntax is wrong (see attached JPG)

        br,
        Attached Files

        Comment

        • MrMancunian
          Recognized Expert Contributor
          • Jul 2008
          • 569

          #5
          Originally posted by ggeu
          I have never seen a Dim in vb6 with points !!!
          Who is talking about vb6? OP didn't mention anything about that and also he posted in the .NET-forum...

          @Aussie1333: When you declare something, you want to give it a type. Generally, it looks like this:
          Code:
          Dim variablename As Type
          I guess you have in mind that you want to display a list of pizza's in a listbox. For that, you want to create an array of 8 items. Of course, these are all hypothetical assumptions. Say you want to save 8 different names of pizza's. A name is a string, so you create a string array.
          Code:
          Dim strPizzaArray(7) as String
          Check out the MSDN on Arrays to learn more. Now, you have an array of 8 empty strings (0...7) you want to fill. You can do that like this:
          Code:
          strPizzaArray(0) = "Pepperoni"
          strPizzaArray(1) = "Funghi"
          strPizzaArray(2) = "Quattro Formaggio"
          etc...
          Now, I'm assuming you have a Listbox on a form called Listbox1. You can loop through the array with pizza names to add them to the lisbox. It should look a bit like this:
          Code:
          For a As Integer = 0 to strPizzaArray().Length - 1
            Listbox1.Items.Add(strPizzaArray(a))
          Next
          I think this should answer some of your questions. Have fun!

          Steven

          Comment

          • Aussie1333
            New Member
            • Apr 2010
            • 3

            #6
            Originally posted by MrMancunian
            Who is talking about vb6? OP didn't mention anything about that and also he posted in the .NET-forum...

            @Aussie1333: When you declare something, you want to give it a type. Generally, it looks like this:
            Code:
            Dim variablename As Type
            I guess you have in mind that you want to display a list of pizza's in a listbox. For that, you want to create an array of 8 items. Of course, these are all hypothetical assumptions. Say you want to save 8 different names of pizza's. A name is a string, so you create a string array.
            Code:
            Dim strPizzaArray(7) as String
            Check out the MSDN on Arrays to learn more. Now, you have an array of 8 empty strings (0...7) you want to fill. You can do that like this:
            Code:
            strPizzaArray(0) = "Pepperoni"
            strPizzaArray(1) = "Funghi"
            strPizzaArray(2) = "Quattro Formaggio"
            etc...
            Now, I'm assuming you have a Listbox on a form called Listbox1. You can loop through the array with pizza names to add them to the lisbox. It should look a bit like this:
            Code:
            For a As Integer = 0 to strPizzaArray().Length - 1
              Listbox1.Items.Add(strPizzaArray(a))
            Next
            I think this should answer some of your questions. Have fun!

            Steven
            I already had the listbox and I had checkboxes and radio buttons to add their text to the listbox, so how do I make it possible for those to be copied?

            Comment

            • MrMancunian
              Recognized Expert Contributor
              • Jul 2008
              • 569

              #7
              Please rephrase your question...

              "How do I make it possible for <WHAT?> to be copied <WHERE>?"

              Steven

              Comment

              • Aussie1333
                New Member
                • Apr 2010
                • 3

                #8
                ok. How do I make it possible for the contents of my listbox to be copied to a word processor or to the clipboard?

                Comment

                Working...