All pastes #623700 Raw Edit

shodan

public text v1 · immutable
·published 2007-07-17 19:53 UTC
rendered paste body
    Public Function AddNewControl(ByVal type As String) As Object

        Dim oNewControl As Object
        Dim oNewLabel As New System.Windows.Forms.Label
        Dim oNewButton As New System.Windows.Forms.Button
        Dim oNewTextbox As New System.Windows.Forms.TextBox
        Dim oNewCheckbox As New System.Windows.Forms.CheckBox
        Dim oNewCombobox As New System.Windows.Forms.ComboBox

        Select Case type
            Case "label"
                Me.List.Add(oNewLabel)
                HostForm.Controls.Add(oNewLabel)
                oNewLabel.Tag = Me.Count
                oNewControl = oNewLabel

            Case "button"
                Me.List.Add(oNewButton)
                HostForm.Controls.Add(oNewButton)
                oNewButton.Tag = Me.Count
                oNewControl = oNewButton

            Case "textbox"
                Me.List.Add(oNewTextbox)
                HostForm.Controls.Add(oNewTextbox)
                oNewTextbox.Tag = Me.Count
                oNewControl = oNewTextbox

            Case "checkbox"
                Me.List.Add(oNewCheckbox)
                HostForm.Controls.Add(oNewCheckbox)
                oNewCheckbox.Tag = Me.Count
                oNewControl = oNewCheckbox

            Case "combobox"
                Me.List.Add(oNewCombobox)
                HostForm.Controls.Add(oNewCombobox)
                oNewCombobox.Tag = Me.Count
                oNewControl = oNewCombobox

        End Select

        Return oNewControl

    End Function