An expression including function causes termination - 01-26-2005 , 06:58 AM
I am very new to .NET (Professional 2003).
I upgraded just now a VB 6.0 application to .NET. The upgrade was
fine. I have made required corrections. The application starts OK. It
executes through quite a complicate part including getting data from
an Access database.
The application stops on a command, simple from my point of view. The
command assigns a function's return to a string. The application runs
through the function OK, I have checked step by step. After returning
from the function, the application suddenly jumps to the end without
any explanations. Debug window displays "The program '
Project1.exe' has exited with code 0 (0x0)."
Here is a definition of the string, the line of code and the function:
Dim Centre1 As String
Centre1 = GetCentre1(PCsRSet.Fields("IDENTIFICATION").Value)
Public Function GetCentre1(ByRef ID As String) As String
'This function returns centre as a function of identification code
GetCentre1 = ""
Do While Not ConditionsRSet.EOF
If InStr(ID, ConditionsRSet.Fields("Condition").Value) > 0 Then
GetCentre1 = ConditionsRSet.Fields("Site").Value
Any help will be greatly appreciated.
RE: An expression including function causes termination - 01-26-2005 , 08:30 PM
The exit code of 0 tells me that the program ended successfully.
By chance is your application's startup object a Sub Main? If I'm correct
the problem is that in VB.Net when Sub Main finishes the program exits.
vbup1047.asp for a little more information
In this Sub Main do you show a form and this form is not being shown? The
simple solution for this is to use Application.Run(FormName) in place of
FormName.Show inside your Sub Main
If this is not the case can you please provide more details about where
you're calling this function from and what is not happening that you expect.
John Hart, Microsoft VB Team
This posting is provided "AS IS" with no warranties, and confers no rights.
|Thread Tools||Search this Thread|