I'm not quite sure what you are asking.
Your GetFileContents Function is supposed to return a String value....if it fails within the Try/Catch block your function doesn't return. Maybe this is your problem? I'd move the Return strContents outside of the Try/Catch block so that it always returns a String (even if it's empty).
I'm not quite sure what you mean by "it won't let you" call a function after you've retrieved your data from the database.....
To call a function in .NET you just...call it...
For instance if you were calling your GetFileContents function you would do something like
-
Dim myFileContents As String = GetFileContents(valueStr, fullPathStr)
-
This will call the function and store the function's output into the myFileContents String....(but if there was a problem then nothing's returned...you should fix this)
Could you be more clear about the problem?
Thanks
-Frinny
You're a star, thank you!!!
One last question. Do you know how to call a function in VB.NET. I have the following:
-
Public Function GetFileContents(ByVal value As String, ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String
-
-
Dim strContents As String
-
Dim objReader As StreamReader
-
Dim bAns As Boolean = False
-
Dim i As Integer
-
-
Try
-
-
objReader = New StreamReader("Last5.txt")
-
For i = 0 To i < 4
-
strContents = objReader.ReadToEnd()
-
objReader.Close()
-
Return strContents
-
socket.SendData(strContents)
-
Next
-
-
Catch Ex As Exception
-
ErrInfo = Ex.Message
-
End Try
-
-
-
End Function
-
-
Public Function SaveTextToFile(ByVal strData As String, ByVal FullPath As String, Optional ByVal ErrInfo As String = "") As Boolean
-
-
-
Dim bAns As Boolean = False
-
Dim objReader As StreamWriter
-
Try
-
-
-
objReader = New StreamWriter("Last5.txt")
-
objReader.Write(strData)
-
objReader.Close()
-
bAns = True
-
Catch Ex As Exception
-
ErrInfo = Ex.Message
-
-
End Try
-
Return bAns
-
End Function
-
-
And I want to call that Function after my SQL query has a result but it won't let me. Do you know how to do this?