Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

javaSpy

Browsing clsUserSelection.vb (1.92 KB)

Option Explicit On

Public Class clsUserSelection

    Public thisHost As Object = Nothing
    Public AllowCancel As Boolean = False
    Public retIndex As Integer = -1

    Private _columns As New Collection
    Private _rows As New Collection

    Public Sub New(ByVal thisHost As Object)
        Me.thisHost = thisHost
    End Sub

    Public Sub AddColumn(ByVal colText As String)
        _columns.Add(colText)
    End Sub

    Public Sub AddRow(ByVal ParamArray cellText() As String)
        _rows.Add(cellText)
    End Sub

    Public Sub AddRows(ByVal ParamArray cellText() As String)

        For i As Integer = 0 To cellText.Length - 1
            _rows.Add(cellText(i))
        Next

    End Sub

    Public Sub AddRowsSingle(ByVal ParamArray cellText() As String)

        For i As Integer = 0 To cellText.Length - 1
            _rows.Add(New String() {cellText(i)})
        Next

    End Sub

    Public Function GetColumn(ByVal index As Integer) As String

        If index > 0 And index <= _columns.Count Then
            Return _columns(index)
        Else
            Return ""
        End If

    End Function

    Public Function GetColumnCount() As Integer
        Return _columns.Count
    End Function

    Public Function GetRow(ByVal index As Integer) As String()

        If index > 0 And index <= _rows.Count Then
            Return _rows(index)
        Else
            Return Array.CreateInstance(GetType(String), 0)
        End If

    End Function

    Public Function GetRows() As Collection
        Return _rows
    End Function

    Public Function GetRowCount() As Integer
        Return _rows.Count
    End Function

    Public Sub Show(Optional ByVal caption As String = Nothing)

        ' instantiate a new selection dialog
        With New frmUserSelection(Me, caption)
            .ShowDialog(thisHost)
        End With

    End Sub

End Class

Download clsUserSelection.vb

Back to file list


Back to project page