Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/11/2016, 12:47
KenMasters
 
Fecha de Ingreso: abril-2005
Ubicación: Piura - Perú
Mensajes: 189
Antigüedad: 19 años
Puntos: 0
Respuesta: VB6: Problema salto de linea

Se soluciono con esta codigo al final

Código vb:
Ver original
  1. Function sfuncEndVBCRLFremoved(strSource As String, Optional bTrimSource As Boolean = True) As String
  2. On Error GoTo err_h:
  3.  
  4. Dim s As String
  5. Dim iLen As Integer
  6.  
  7. If bTrimSource Then strSource = Trim$(strSource)
  8.  
  9. testPoint:
  10.  
  11. 'get last two characters of string
  12. s = Mid$(strSource, Len(strSource) - 1, 2)
  13.  
  14. 'len of [strSource]
  15. iLen = Len(strSource)
  16.  
  17. 'if last two characters are carriage return and
  18. 'line feed then trim off the last 2 characters
  19. If s = vbCrLf Then
  20.          strSource = Mid$(strSource, 1, (iLen - 2))
  21.          GoTo testPoint: 'test last two characters
  22. End If
  23.  
  24. 'return with trailing carriage returns removed
  25. sfuncEndVBCRLFremoved = strSource
  26.  
  27.  
  28. Exit Function
  29. err_h:
  30. With Err
  31.      If .Number <> 0 Then
  32.             'create .bas named [ErrHandler]  see http://vb6.info/h764u
  33.            ErrHandler.ReportError Date & ": Str.sfuncEndVBCRLFremoved." & Err.Number & "." & Err.Description
  34.             Resume Next
  35.       End If
  36. End With
  37. End Function