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
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:
[color=blue]Module[/color] modCensus
[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]
[color=green]'Set the view to show details[/color]
ListView1.View = View.Details
[color=blue]End Sub[/color]
[color=blue]End Module[/color]
then in the Form to trigger the Populate Sub in the Module...
VB Code:
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]