Click here to Skip to main content
15,929,218 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Message Handler in VB.NET Pin
JGraves26-Jul-02 8:46
JGraves26-Jul-02 8:46 
GeneralRe: Message Handler in VB.NET Pin
Richard Deeming29-Jul-02 1:21
mveRichard Deeming29-Jul-02 1:21 
GeneralRe: Message Handler in VB.NET Pin
JGraves29-Jul-02 4:18
JGraves29-Jul-02 4:18 
GeneralComboBox - MultiColumn Pin
mikasa24-Jul-02 2:52
mikasa24-Jul-02 2:52 
GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming26-Jul-02 6:07
mveRichard Deeming26-Jul-02 6:07 
GeneralRe: ComboBox - MultiColumn Pin
mikasa17-Jan-03 10:03
mikasa17-Jan-03 10:03 
GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming5-Aug-02 1:04
mveRichard Deeming5-Aug-02 1:04 
GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming5-Aug-02 1:11
mveRichard Deeming5-Aug-02 1:11 
Next, define a collection of DataColumns:
Imports System.ComponentModel
Imports System.Collections
Imports System.Windows.Forms

Public Class DataColumnCollection : Inherits CollectionBase

    Private _Parent As Control

#Region "Constructors"
    Public Sub New()
        'Do Nothing
    End Sub
    Public Sub New(ByVal Value() As DataColumn)
        AddRange(Value)
    End Sub
    Public Sub New(ByVal Value As DataColumnCollection)
        AddRange(Value)
    End Sub
#End Region

#Region "Add"
    Public Function Add(ByVal Value As DataColumn) As Integer
        Value.Parent = Me
        Return List.Add(Value)
    End Function
    Public Sub AddRange(ByVal Value() As DataColumn)
        Dim oItem As DataColumn
        For Each oItem In Value
            oItem.Parent = Me
            List.Add(oItem)
        Next
    End Sub
    Public Sub AddRange(ByVal Value As DataColumnCollection)
        Dim oItem As DataColumn
        For Each oItem In Value
            oItem.Parent = Me
            List.Add(oItem)
        Next
    End Sub
#End Region

    Public Function Contains(ByVal Value As DataColumn) As Boolean
        Return List.Contains(Value)
    End Function
    Public Sub CopyTo(ByVal array() As DataColumn, ByVal index As Integer)
        List.CopyTo(array, index)
    End Sub
    Public Overloads Function IndexOf(ByVal Value As DataColumn) As Integer
        Return List.IndexOf(Value)
    End Function
    Public Sub Insert(ByVal index As Integer, ByVal Value As DataColumn)
        List.Insert(index, Value)
    End Sub

    Default Public Property Item(ByVal index As Integer) As DataColumn
        Get
            Return DirectCast(List.Item(index), DataColumn)
        End Get
        Set(ByVal Value As DataColumn)
            List.Item(index) = Value
        End Set
    End Property


    Protected Overrides Sub OnInsert(ByVal index As Integer, _
                                                ByVal Value As Object)

        If TypeOf Value Is DataColumn Then
            MyBase.OnInsert(index, Value)
            DirectCast(Value, DataColumn).Parent = Me
        Else
            Throw New ArgumentException()
        End If
    End Sub

    Protected Overrides Sub OnSet(ByVal index As Integer, _
                                            ByVal OldValue As Object, _
                                            ByVal NewValue As Object)

        If TypeOf NewValue Is DataColumn Then
            MyBase.OnSet(index, OldValue, NewValue)
            DirectCast(NewValue, DataColumn).Parent = Me
        Else
            Throw New ArgumentException()
        End If
    End Sub

    Protected Friend Property Parent() As Control
        Get
            Return _Parent
        End Get
        Set(ByVal Value As Control)
            _Parent = Value
        End Set
    End Property

    Public ReadOnly Property ParentWidth() As Integer
        Get
            If _Parent Is Nothing Then
                Return 0
            Else
                Return _Parent.ClientSize.Width
            End If
        End Get
    End Property
End Class

GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming5-Aug-02 1:23
mveRichard Deeming5-Aug-02 1:23 
GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming5-Aug-02 1:24
mveRichard Deeming5-Aug-02 1:24 
GeneralRe: ComboBox - MultiColumn Pin
mikasa5-Aug-02 4:41
mikasa5-Aug-02 4:41 
GeneralRe: ComboBox - MultiColumn Pin
Richard Deeming5-Aug-02 22:42
mveRichard Deeming5-Aug-02 22:42 
Generalsocket programming in vb Pin
kavitha24-Jul-02 2:22
kavitha24-Jul-02 2:22 
GeneralRe: socket programming in vb Pin
Nick Parker25-Jul-02 8:17
protectorNick Parker25-Jul-02 8:17 
GeneralVB and Excel 2000 interaction Pin
patty23-Jul-02 22:12
patty23-Jul-02 22:12 
GeneralRe: VB and Excel 2000 interaction Pin
afronaut25-Jul-02 15:36
afronaut25-Jul-02 15:36 
GeneralRe: VB and Excel 2000 interaction Pin
patty25-Jul-02 22:49
patty25-Jul-02 22:49 
QuestionHow to get info abt printer in vb 6 Pin
Birdy23-Jul-02 20:03
Birdy23-Jul-02 20:03 
GeneralINET Control Web Proxy Problems Pin
TheChocolatay22-Jul-02 6:49
TheChocolatay22-Jul-02 6:49 
Generalvb6 webbrowser control Pin
Anonymous22-Jul-02 3:34
Anonymous22-Jul-02 3:34 
GeneralConverting IEEE Format Singles To Internal Longs Pin
Jason Teagle22-Jul-02 0:29
Jason Teagle22-Jul-02 0:29 
GeneralRe: Converting IEEE Format Singles To Internal Longs Pin
Richard Deeming22-Jul-02 23:46
mveRichard Deeming22-Jul-02 23:46 
GeneralRe: Converting IEEE Format Singles To Internal Longs Pin
Jason Teagle22-Jul-02 23:49
Jason Teagle22-Jul-02 23:49 
Generaledit explorer.exe Pin
Manish Wadhera20-Jul-02 20:53
Manish Wadhera20-Jul-02 20:53 
GeneralRe: edit explorer.exe Pin
SHaroz21-Jul-02 16:37
SHaroz21-Jul-02 16:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.