Any chance you can give us some more code. Preferably the whole function?
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Any chance you can give us some more code. Preferably the whole function?
even though i've found the answer the rest of the non designer class was
Code:
Namespace Controls.Misc
Public Class BlankSummary
Public Property ShowControls() As Boolean
Get
Return ToolStrip1.Visible
End Get
Set(ByVal value As Boolean)
ToolStrip1.Visible = value
End Set
End Property
Public Property ShowDeleted() As Boolean
Get
Return tsCbShowDel.Checked
End Get
Set(ByVal value As Boolean)
tsCbShowDel.Checked = value
End Set
End Property
Public Property ShowLabel() As Boolean
Get
Return tsLblTxt.Visible
End Get
Set(ByVal value As Boolean)
tsLblTxt.Visible = value
End Set
End Property
Public Property LabelText() As String
Get
Return tsLblTxt.Text
End Get
Set(ByVal value As String)
tsLblTxt.Text = value
End Set
End Property
Protected ItemSelector As New Hashtable
Sub ItemAdd(ByVal item As Bases.Base_Archive)
If ShowDeleted Or item.Active Then
Dim lvi As New ListViewItem
lvi = lvSummary.Items.Add(item.ToLVI)
ItemSelector.Add(lvi, item)
End If
End Sub
Sub ItemRemove(ByVal item As ListViewItem)
ItemSelector.Remove(item)
lvSummary.Items.Remove(item)
End Sub
Sub ItemReset()
ItemSelector.Clear()
lvSummary.Items.Clear()
End Sub
Protected bRefreshing As Boolean = False
Public Overridable Sub RefreshData()
bRefreshing = True
Try
lvSummary.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
Catch ex As Exception
End Try
If Not tsCbShowDel.Checked Then
colDel.Width = 0
End If
lvSummary.Sort()
bRefreshing = False
End Sub
Private oSelected As Object
Public Property SelectedObject() As Object
Get
Return oSelected
End Get
Set(ByVal value As Object)
oSelected = value
RefreshData()
End Set
End Property
Public Event SelectedChanged(ByVal NewValue As Object)
Public Event AddItem()
Public Sub AddButton(ByVal item As ToolStripItem)
tsButAdd.DropDownItems.Add(item)
tsButAdd.ShowDropDownArrow = True
End Sub
Public Sub ResetButtons()
tsButAdd.DropDownItems.Clear()
tsButAdd.ShowDropDownArrow = False
End Sub
Private Sub lb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvSummary.SelectedIndexChanged
If Not bRefreshing Then
oSelected = Nothing
For Each lvi As ListViewItem In lvSummary.SelectedItems
oSelected = ItemSelector(lvi)
Next
RaiseEvent SelectedChanged(oSelected)
End If
End Sub
Private Sub tsCbShowDel_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsCbShowDel.CheckedChanged
RefreshData()
End Sub
Private Sub tsButAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsButAdd.Click
RaiseEvent AddItem()
End Sub
Public Sub New()
InitializeComponent()
End Sub
End Class
End Namespace
it's a generic class for displaying a interactive summary of an object in a list view
i provide specialisation in inheriting classes and in the Overridable ToLVI Function
__________________
Definition of a Beginner, Someone who doesn't know the rules.
Definition of an Expert, Someone who knows when to ignore the rules.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish