25/09/2008 Development / asp3

Projeto: FH
Classe : Controles


' Importe as referencias
' ******************************************************
' * Microsoft Scripting Runtime
' * Microsoft Active Server Pages


' Cole o código abaixo
' ******************************************************
Private oAttributes
    Private sQuery
    Private objCombo
   
    Private Sub Class_Initialize()
        Set oAttributes = CreateObject("Scripting.Dictionary")
    End Sub

    Public Property Let setAttribute(attributeName, attributeValue)
        oAttributes.Add attributeName, attributeValue
    End Property
   
    Public Property Let SQL(query)
        sQuery = query
    End Property

    Public Function Create()
       
        objCombo = "<select"
       
        For Each sKey In oAttributes
            objCombo = objCombo & Space(1) & sKey & "=""" & oAttributes(sKey) & """"
        Next
        objCombo = objCombo & ">" & vbCrLf
       
        objCombo = objCombo & "<option>" & sQuery & "</option>"
       
        objCombo = objCombo & "</select>"
       
        Create = objCombo
       
    End Function

 

Clique em File e depois Make FH.dll
Procure salvar esta dll na pasta System32 e depois registre-a.
Pronto!!!!

Agora na página.asp

<%
Set oCombo = Server.CreateObject("FH.Controles")
oCombo.setAttribute("class") = "cssCombo"
oCombo.setAttribute("onchange") = "suaFunction()"
response.write oCombo.Create
%>