1) Since I need to set the size of the textbuilder before retrieveing the data, any extra space after the data is being filled with strange characters
2) When I try to replace the vbcrlf with a <br> to display in the browser it does not find vbcrlf.
Any help with this would be greatly appreciated.
Here is sample code:
Code: Select all
Public Function getFieldValue(ByVal sFieldName As String, ByVal iSize As Integer, Optional ByVal bClose As Boolean = False) As String
Dim value As String
Dim sFieldValue As New System.Text.StringBuilder(iSize)
APIWrapper.SPGetFieldValue(sFieldName, sFieldValue, iSize)
value = sFieldValue.ToString
getFieldValue = Regex.Replace(value, "[^A-Za-z0-9\s]+", "")
If bClose Then
APIWrapper.SPCloseFile()
End If
End Function
Public Function openFile(ByVal sName As String, ByVal sFirmfile As String) As Integer
openFile = APIWrapper.SPOpenFile("default", sFirmfile)
End Function
End Class
Public Class APIWrapper
Declare Ansi Function CreateProFormFile Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" _
(ByVal csUserID As String, _
ByVal chOptionalTemplateFilePath As String, _
ByVal csPrefix As String, _
ByVal csSuffix As String, _
ByVal lType As Int32, _
ByVal csFileNumbCode As String, _
ByVal newFileID As System.Text.StringBuilder) As Integer
Declare Ansi Function SPGetFieldValue Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" _
(ByVal chFieldName As String, _
ByVal chReturnValue As System.Text.StringBuilder, _
ByVal nMaxSize As Integer) As Integer
Declare Ansi Function SPSetFieldValue Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" _
(ByVal chFieldName As String, _
ByVal chFieldValue As String) As Integer
Declare Ansi Function SPOpenFile Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" _
(ByVal csUserID As String, ByVal csFileID As String) As Integer
Declare Ansi Function SPSaveFile Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" () As Integer
Declare Ansi Function SPCloseFile Lib "C:\Inetpub\wwwroot\TestAPI\bin\ProFormAPI.dll" () As Integer
End Class
'Here is a function call which returns the county name along with extra garbage characters.
Proform.getFieldValue("County", 50)