0
Answer

VB 2008 - Custom control and Listview

Ask a question
Gilles

Gilles

15y
4.6k
1

Hi All !

I'm a beginner in VB2008 (Express Ed). I'm building an application to manage an Role Playing Game Character Sheet (like AD&D for the ones who know what it is)

I'm trying to create the Inventory of my Character and for this purpose I would like to create a custom control ...let's say Inventory_Item with many Properties (ex: Value, Category, is Magical etc..etc..) Then use many instances of this object to poplate a listview.

Right now i've build up the class Inventory_Item (see following code)

Public Class Inventory_Item

Private isMagical As Boolean = False

Private isValuable As Boolean = False

Private _Category As String = ""

Private _Qty As Integer = 0

Private _Value As Integer = 0

Private _Name As String = ""

Private _Index As Integer = 0

Public Property Index() As Integer

Get

Return _Index

End Get

Set(ByVal value As Integer)

_Index = value

End Set

End Property

Public Property Name() As String

Get

Return _Name

End Get

Set(ByVal value As String)

_Name = value

End Set

End Property

Public Property Magical() As Boolean

Get

Return isMagical

End Get

Set(ByVal value As Boolean)

isMagical = value

End Set

End Property

Public Property Valuable() As Boolean

Get

Return isValuable

End Get

Set(ByVal value As Boolean)

isValuable = value

End Set

End Property

Public Property Value() As Integer

Get

Return _Value

End Get

Set(ByVal value As Integer)

_Value = value

End Set

End Property

Public Property Category() As String

Get

Return _Category

End Get

Set(ByVal value As String)

_Category = value

End Set

End Property

Public Property Qty() As Integer

Get

Return _Qty

End Get

Set(ByVal value As Integer)

_Qty = value

End Set

End Property

My problem is that I don't know how to create a "matrix" or array of this control, modify some properties of some of them and use the listview as the visual part of it (displaying all the items and properites)

My idea is to use the Listview to manage the Inventory_Items then saving each item in an INI file like I'm dooing for every other data in my App.

Please Help, It would be very kind of you

Thank you in advance

Gilles