Global listview question

D

Derck

SORRY, for the crosspost, but I think I posted it in the wrong group!

Hello all,

I have a question.. I am tying to make a global listview class where other
listviews in my application points to, so when I change something in that
listview all listviews who points to that listview must be updated.. But I
don't have a idea why it isn't working..

I tried to make a singeton listview class and get a instance on the form
from a class but there is nothing visible in the form listviews, or when I
change something in the listview class it's also not visible, but when I
"wacth" them the properties are filled.

What am I doing wrong? Or is this not possible?

Thanks in advance,

Derck Weelink

**********Form*****************
lstTest = UserListView.GetInstance

lst2 = UserListView.GetInstance

********************************

*********************Class***************
Imports System.Threading
Module Controls

Public Class UserListView

'Inherits System.Windows.Forms.ListView

Private Shared moUserListView As mcUserListView

Private Shared _mu As New Mutex

Private Sub New()

'mUserListView = New System.Windows.Forms.ListView

MyBase.New()

'MyBase.View = View.Details

'MyBase.Columns.Add("Ajaja", 100, HorizontalAlignment.Left)

End Sub

Public Shared Function GetInstance() As ListView

_mu.WaitOne()

Try

If moUserListView Is Nothing Then

moUserListView = New mcUserListView

'mUserListView.Columns.Add("test", 100, HorizontalAlignment.Left)

'mUserListView.View = View.Details

'mUserListView.Columns.Add("Yeah", 100, HorizontalAlignment.Left)

'mUserListView.Items.Add("OINI")

End If

Finally

_mu.ReleaseMutex()

End Try

Return moUserListView

End Function

Private Class mcUserListView

Inherits ListView

Public Sub New()

MyBase.New()

Me.View = View.Details

Me.Columns.Add("oinerg", 100, HorizontalAlignment.Left)

End Sub

Public Shadows Property View() As View

Get

Return MyBase.View

End Get

Set(ByVal Value As View)

MyBase.View = Value

MyBase.Refresh()

End Set

End Property

End Class

'Public Overrides ReadOnly Property Items() As ListViewItemCollection

' Get

' End Get

'End Property

End Class

End Module

***********************************
 
D

Derck

Derck said:
SORRY, for the crosspost, but I think I posted it in the wrong group!

Hello all,

I have a question.. I am tying to make a global listview class where other
listviews in my application points to, so when I change something in that
listview all listviews who points to that listview must be updated.. But I
don't have a idea why it isn't working..

I tried to make a singeton listview class and get a instance on the form
from a class but there is nothing visible in the form listviews, or when I
change something in the listview class it's also not visible, but when I
"wacth" them the properties are filled.

What am I doing wrong? Or is this not possible?

Thanks in advance,

Derck Weelink

**********Form*****************
lstTest = UserListView.GetInstance

lst2 = UserListView.GetInstance

********************************

*********************Class***************
Imports System.Threading
Module Controls

Public Class UserListView

'Inherits System.Windows.Forms.ListView

Private Shared moUserListView As mcUserListView

Private Shared _mu As New Mutex

Private Sub New()

'mUserListView = New System.Windows.Forms.ListView

MyBase.New()

'MyBase.View = View.Details

'MyBase.Columns.Add("Ajaja", 100, HorizontalAlignment.Left)

End Sub

Public Shared Function GetInstance() As ListView

_mu.WaitOne()

Try

If moUserListView Is Nothing Then

moUserListView = New mcUserListView

'mUserListView.Columns.Add("test", 100, HorizontalAlignment.Left)

'mUserListView.View = View.Details

'mUserListView.Columns.Add("Yeah", 100, HorizontalAlignment.Left)

'mUserListView.Items.Add("OINI")

End If

Finally

_mu.ReleaseMutex()

End Try

Return moUserListView

End Function

Private Class mcUserListView

Inherits ListView

Public Sub New()

MyBase.New()

Me.View = View.Details

Me.Columns.Add("oinerg", 100, HorizontalAlignment.Left)

End Sub

Public Shadows Property View() As View

Get

Return MyBase.View

End Get

Set(ByVal Value As View)

MyBase.View = Value

MyBase.Refresh()

End Set

End Property

End Class

'Public Overrides ReadOnly Property Items() As ListViewItemCollection

' Get

' End Get

'End Property

End Class

End Module

***********************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top