Results 1 to 4 of 4

Thread: Listview - adding an item

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    17

    Unhappy

    Help....why won't this work?

    Dim itemAdd as ListItem
    Set itmAdd = ListView1.ListItems.Add(Text:=sNext)

    I get a type mismatch. sNext is a string


  2. #2
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Try This:

    Code:
    Dim Snext As String
    Snext = "String"
    ListView1.ListItems.Add , , Snext
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  3. #3
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Or it's because you did this:

    Dim itemAdd as ListItem
    Set itmAdd = ListView1.ListItems.Add(Text:=sNext)

    But you names the listitem itemadd and the set thing itmadd.
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Code:
    Dim itemAdd As String
    Dim sNext As String
    sNext = "JOPPPPP!"
    itemAdd = ListView1.ListItems.Add(1, "Key1", sNext)
    works for me.

    For spellchecking in variables be sure to check this box:
    Click in the VB IDE: TOOLS > OPTIONS > and check REQUIRE VARIABLE DECLARATION
    this way you don't have to deal with undeclared variables.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width