Tips.cl

VB.60

Formatear Números con ceros a la izquierda

by MigueliTUX on Aug.07, 2009, under VB.60

Aquí les dejo una función escrita en VB para formatear números

1
2
3
4
Function FormatNumero(ByVal IStr As String, ByVal Longitud As Integer) As String
        'formatea como número con ceros a la izquierda
        return String(Longitud - Len(IStr), "0") & IStr
End Function
5 Comentarios :, , más...

XSL - XML

by MigueliTUX on Oct.28, 2008, under VB.60, Windows

Aqui les dejo un codigo que inclui en una componente. Se trata de dos metodos que hacen lo mismo, transformar el xml con un xsl a una pagina web.

Option Explicit

****** Esta funcion transforma el archivo XML con el Archivo XSL ******
****** Retorna el string que despues en la pagina asp se dibuja con
****** request.write(string)

Public Function TransXML2String(ByVal xmlFile As String, ByVal xslFile As String) As String

Dim source As New Msxml2.DOMDocument30
Dim stylesheet As New Msxml2.DOMDocument30

Dim myErr
Dim msgReturn As String

‘ Load data.
source.async = False
source.Load (xmlFile)

If (source.parseError.errorCode <> 0) Then
Set myErr = source.parseError
msgReturn = myErr.reason
Else
‘ Load style sheet.
stylesheet.async = False
stylesheet.Load (xslFile)

If (stylesheet.parseError.errorCode <> 0) Then
Set myErr = stylesheet.parseError
msgReturn = myErr.reason
Else
‘ Do the transform.
msgReturn = source.transformNode(stylesheet)
End If

End If

TransXML2String = msgReturn

End Function

****** Esta funcion transforma el string XML con el Archivo XSL ******
****** Retorna el string que despues en la pagina asp se dibuja con
****** request.write(string)

Public Function TransStringXML2String(ByVal xmlString As String, ByVal xslFile As String) As String

Dim source As New Msxml2.DOMDocument30
Dim stylesheet As New Msxml2.DOMDocument30

Dim myErr
Dim msgReturn As String

‘ Load data.
source.async = False
source.loadXML (xmlString)

If (source.parseError.errorCode <> 0) Then
Set myErr = source.parseError
msgReturn = myErr.reason
Else
‘ Load style sheet.
stylesheet.async = False
stylesheet.Load (xslFile)

If (stylesheet.parseError.errorCode <> 0) Then
Set myErr = stylesheet.parseError
msgReturn = myErr.reason
Else
‘ Do the transform.
msgReturn = source.transformNode(stylesheet)
End If

End If

TransStringXML2String = msgReturn

End Function

1 Comentario :, , más...

Buscas algun tips?

Busca aquí:

contactate con nosotos contacto@tips.cl

Visita nuestras Web amigas!

Web Amigas...