T
tmaster
Within a class, can I create a property that is a listview? Here's what I
tried, but it doesn't seem to work:
'------------ create property to give the second form access to the first
form's listview:
Public Class frmToDoDetail ' (this is the second form)
Inherits System.Windows.Forms.Form
Private m_lvwTD As ListView
Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property
'--- try to access the passed listview:
' I've tried all of these references from frmToDoDetail unsuccessfully:
' The error I get is 'Object reference not set to an instance of an object'.
lvwTD.refresh
me.lvwTD.refresh
me.m_lvwTD.refresh
'------------ try to pass the listview. This sub is part of a form (the
first form) that has a listview on it called lvwToDo:
Private Sub lvwToDo_ItemActivate(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lvwToDo.SelectedIndexChanged
Dim frmTemp As New frmToDoDetail()
frmTemp.lvwTD = lvwToDo
'After the above statement executes, the debugger says that
lvwToDo={System.Windows.Form.Listview}, but frmTemp.lvwTD=nothing.
tried, but it doesn't seem to work:
'------------ create property to give the second form access to the first
form's listview:
Public Class frmToDoDetail ' (this is the second form)
Inherits System.Windows.Forms.Form
Private m_lvwTD As ListView
Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property
'--- try to access the passed listview:
' I've tried all of these references from frmToDoDetail unsuccessfully:
' The error I get is 'Object reference not set to an instance of an object'.
lvwTD.refresh
me.lvwTD.refresh
me.m_lvwTD.refresh
'------------ try to pass the listview. This sub is part of a form (the
first form) that has a listview on it called lvwToDo:
Private Sub lvwToDo_ItemActivate(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lvwToDo.SelectedIndexChanged
Dim frmTemp As New frmToDoDetail()
frmTemp.lvwTD = lvwToDo
'After the above statement executes, the debugger says that
lvwToDo={System.Windows.Form.Listview}, but frmTemp.lvwTD=nothing.