Results 1 to 4 of 4

Thread: Declaring a listview [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member GSIV's Avatar
    Join Date
    Jun 2002
    Location
    Texas, USA
    Posts
    213

    Question Declaring a listview [RESOLVED]

    I have a form which contains ListView1. I am trying to call the sub Populate from a module, but am getting an error that ListView1 is not declared. If I run it from the form_load it will work fine. What do I need to do to fix this?


    Module modCensus
    Public Sub Populate()
    'Set the view to show details
    ListView1.View = View.Details
    End Sub
    End Module
    Last edited by GSIV; Nov 10th, 2003 at 10:13 AM.

  2. #2

    Thread Starter
    Addicted Member GSIV's Avatar
    Join Date
    Jun 2002
    Location
    Texas, USA
    Posts
    213
    Here's what I have so far... non-working
    Attached Files Attached Files

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    if you are trying to do stuff to a ListView which is on a Form , from a Module , you will need to declare the Form ( as you cant just access your Form's controls from a Module. ) you'd need to do something like this ....
    in your Module ....
    VB Code:
    1. [color=blue]Module[/color] modCensus
    2. [color=blue]Public Sub[/color] Populate([color=blue]ByVal[/color] frm [color=blue]As[/color] Form1) [color=green]'/// where your Form's name goes , where i put Form1.[/color]
    3. [color=green]'Set the view to show details[/color]
    4. ListView1.View = View.Details
    5. [color=blue]End Sub[/color]
    6. [color=blue]End Module[/color]
    then in the Form to trigger the Populate Sub in the Module...
    VB Code:
    1. Populate([color=blue]Me[/color])
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4

    Thread Starter
    Addicted Member GSIV's Avatar
    Join Date
    Jun 2002
    Location
    Texas, USA
    Posts
    213
    Thanks DS for the help.

    With your modification, and declaring the listview in the format of frm.listview1 my problem has been resolved.

    Thanks!
    Last edited by GSIV; Nov 10th, 2003 at 10:12 AM.

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