|
'system.componentmodel
Imports System.Windows.Forms
Public Class frmAddCategory
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
' LoadImagestoList()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtCatName As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents ListView1 As System.Windows.Forms.ListView
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents btnOK As System.Windows.Forms.Button
Public WithEvents ImageList1 As System.Windows.Forms.ImageList
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim ListViewItem1 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("")
Dim ListViewItem2 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("")
Dim ListViewItem3 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("")
Dim ListViewItem4 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("")
Dim ListViewItem5 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("")
Me.Label1 = New System.Windows.Forms.Label
Me.btnCancel = New System.Windows.Forms.Button
Me.btnOK = New System.Windows.Forms.Button
Me.txtCatName = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.ListView1 = New System.Windows.Forms.ListView
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(24, 32)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 0
Me.Label1.Text = "Category Name"
'
'btnCancel
'
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.Location = New System.Drawing.Point(208, 232)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.TabIndex = 1
Me.btnCancel.Text = "Cancel"
'
'btnOK
'
Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnOK.Location = New System.Drawing.Point(296, 232)
Me.btnOK.Name = "btnOK"
Me.btnOK.TabIndex = 2
Me.btnOK.Text = "OK"
'
'txtCatName
'
Me.txtCatName.Location = New System.Drawing.Point(136, 32)
Me.txtCatName.Name = "txtCatName"
Me.txtCatName.Size = New System.Drawing.Size(224, 20)
Me.txtCatName.TabIndex = 3
Me.txtCatName.Text = ""
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(24, 72)
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 5
Me.Label2.Text = "Icon"
'
'ListView1
'
Me.ListView1.CausesValidation = False
Me.ListView1.FullRowSelect = True
Me.ListView1.GridLines = True
ListViewItem1.Tag = "0"
ListViewItem2.Tag = "1"
ListViewItem3.Tag = "2"
ListViewItem4.Tag = "3"
ListViewItem5.Tag = "4"
Me.ListView1.Items.AddRange(New System.Windows.Forms.ListViewItem() {ListViewItem1, ListViewItem2, ListViewItem3, ListViewItem4, ListViewItem5})
Me.ListView1.Location = New System.Drawing.Point(136, 64)
Me.ListView1.MultiSelect = False
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(224, 144)
Me.ListView1.SmallImageList = Me.ImageList1
Me.ListView1.TabIndex = 6
Me.ListView1.View = System.Windows.Forms.View.SmallIcon
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'frmAddCategory
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(384, 270)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtCatName)
Me.Controls.Add(Me.btnOK)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.Label1)
Me.Name = "frmAddCategory"
Me.Text = "Add a new category"
Me.ResumeLayout(False)
End Sub
#End Region
Public Property CategoryName() As String
Get
Return txtCatName.Text
End Get
Set(ByVal Value As String)
txtCatName.Text = Value
End Set
End Property
Public Property IconID() As Integer
Get
If Not ListView1.SelectedItems Is Nothing Then
Try
Return ListView1.SelectedItems(0).Index
Catch
Return -1
End Try
Else
Return -1
End If
End Get
Set(ByVal Value As Integer)
'txtCatName.Text = Value
End Set
End Property
Public Sub LoadImagestoList(ByVal ImageList1 As ImageList)
ListView1.Items.Clear()
ListView1.SmallImageList = ImageList1
Dim image As System.Drawing.Image
Dim anitem As ListViewItem
Dim f As Integer
For f = 0 To ListView1.SmallImageList.Images.Count - 1
anitem = ListView1.Items.Add((f + 1).ToString, f)
anitem.ImageIndex = f
Next
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Spent my whole life developing, having worked in C++, Delphi, ASP, then finally settling down to working solely in ASP.Net. Also a forex day trader.