Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    errror 424 when add TAG (6.0)

    Why Object required when add .TAG in column of listview????
    Here the code:
    Public Sub setUpListView()

    On Error GoTo errore

    Dim clmHdr As ColumnHeader

    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "COPE", 950, lvwColumnLeft).Tag = "STRING"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "TIPOLOGIA", 1650, lvwColumnLeft) '.Tag = "STRING"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "FIDO", 600, lvwColumnCenter) '.Tag = "NUMBER"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "ACCORD", 1160, lvwColumnRight) '.Tag = "NUMBER"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "UTILIZZ", 1160, lvwColumnRight) '.Tag = "NUMBER"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "SCONF", 1160, lvwColumnRight) '.Tag = "NUMBER"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "SCAD", 950, lvwColumnLeft) '.Tag = "STRING"
    Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "GG", 580, lvwColumnRight) '.Tag = "NUMBER"
    'Set clmHdr = ListView1.ColumnHeaders. _
    Add(, , "", 0)
    FORM_TREEVIEW_.ListView1.View = lvwReport

    Exit Sub

    errore:
    MsgBox "Errore Numero: " & CStr(Err.Number) & vbCrLf & _
    "Descrizione: " & Err.Description & vbCrLf & _
    "Sorgente dell'Errore: " & Err.Source

    End Sub

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: errror 424 when add TAG (6.0)

    Set should be used only to create an object reference.
    <hr><big>Set clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "COPE", 950, lvwColumnLeft).Tag <span style="background-color: #FFFF00; color: #000000; font-weight: bold">= "STRING"</span hi></big><hr>
    You should not have two = in the same expression. I think VB is reading it like this:
    <hr><big><span style="background-color: #FFFF00; color: #000000; font-weight: bold">Set</span hi> clmHdr = FORM_TREEVIEW_.ListView1.ColumnHeaders. _
    Add(, , "COPE", 950, lvwColumnLeft)<span style="background-color: #FFFF00; color: #000000; font-weight: bold">.Tag</span hi></big><hr>
    That would cause the error because .Tag returns a property, not an object. Here is an illustration to compare what I mean:
    <hr><big>'Set myVar = Object.Property 'Invalid
    Set myVar = Object
    myVar.Property = Value</big><hr>

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: errror 424 when add TAG (6.0)

    Work now!
    Tks.

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: errror 424 when add TAG (6.0)

    AAAAHHHHHHHHHHH...
    How to not permit to the user to resize the column with mouse...???

    Enlarge or reduce column size...

    If is possible used the same code or expalin if is possible in property of listview.
    Tks.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: errror 424 when add TAG (6.0)

    You need a lot of Windows API code for that - see Prevent listview column resizing & mouse cursor.

Posting Permissions

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