MyClass anInstance = null;
if (anInstance == null)
{
Console.WriteLine("The evaluation worked.");
}
As long as you assign something to it (even null) the compiler is happy.
Redirecting to a page that doesn't exist will not generate an exception - you just get a standard 404 error and the default error page.
It may be easier to check the return value of sPath and if it equals "" then display the error message.
You can still use ADO.Net to access non SQL databases, if you are using access then you will use classes under System.Data.OleDB - no need to use the ADODB as that involves all the COM interop and making sure all the ADO stuff is properly installed and registered.
If you fail to explicitly close / dispose of the connection object then you have no control over when it will actually close, even though the page may only exist for less than one second any variables that require garbage collection may be around for a lot longer. If you fail to close DB connections yourself then these no longer needed but not yet garbage collected connections will still be in memory and still be holding on to a physical database connection.
Rather than using ADODB (which is the old COM way of doing things) you probably should consider ADO.Net (System.Data and related classes).
Also you may want to give the database table an Identity (autonumber field) - this way every row will be assigned a unique value.
You could obtain a count of words by doing a SELECT COUNT(*) from HangMan rather than looping through each record one by one....
Then instead of re-reading each record in a loop (for VarI = 1 to ChooseWord) just do a SELECT HangWord from HangMan where ID = Chooseword query.
If you have more specific question when you start to implement this feel free to post again.
you could just change the line that reads
throw
to something like
MessageBox.Show ("Process not found")
to stop it crashing out. However if you step through the code in the debugger which line is the one it fails on?
You will find nearly all the GUI elements are not thread safe, they are designed to be updated from the app's primary thread. If you wish to use them in a multi-threaded way you will need to look at using the control's .Invoke method.
What version of VS / Framework are you using? Have you tried rebooting your system and running the app again?
Are you declaring any Shared (static in C#) objects with shared constructors?
If it's not too large you could post the code here and see if anybody can help
If you compiled in debug mode you could possibly do this using some of the classes under System.Diagnostics but I imagine it could involve a lot of work. Possibly a better question is why do you need this?
You may want to read this thread for some more opinions.
Personally I feel there are easier / cheaper (free) alternatives to VSS, check the links myself and Derek posted above and you may also want to look at http://subversion.tigris.org/ as another alternative
If you are using delegates then you shouldn't need the FnPtr call. However this depends on how the DLL is constructed - what language was it written in and do you have any control over it's code?`
Is there a reason this function can only be accessed by one user at a time - this kind of behaviour can make your life a lot more difficult.
If you are restricting your web service to one user till they log out (the impression I got from your post) then you are going to have serious scalability issues with this scenario.
It may be better to post what the application / web service are doing and see if anyone has a better suggestion for the application architecture.
You were giving it a specific ip address to listen on - unfortunately the one you specified was 127.0.0.1!
Normally this would only be required on a server with multiple ip addresses or multiple physical adapters and you only wanted it to listen on 1. My code just listens on all local addresses.
the delegate definition needs to match with the function definition and vice-versa so in your case the delegate needs to be
Delegate Function DLLPrntDelegate(ByRef fname As CBChar, ByVal x As Integer)
Is the dll also VB6 / vb.net or is it written in another language?
If in .Net you shouldn't require things like the FnPtr function to generate an integer pointer to the function.
In all honesty the migration wizard is pretty useless and tends to generate code that doesn't actually compile and even if it does it rarely works correctly.
If this is your first foray into VB.Net you will find the wizard generated code more confusing and useless than of any real benefit. You are probaby better of re-writing the code yourself.
Most exceptions do not have (or even need an error code) because the type of the exception is the error.
Rather than catch Exception catch the specific type you are after
try
'something
catch ex as DivideByZeroException
'handle
catch ex as OverFlowException
'handle
end try
this gives far more readable code than the vb6 style of error 13 or 6 ,or 57 occurred (means nothing without documentation).
It may help if you post the code within the try block - or at least give the exceptions error message.
Try changing
Dim server As New System.Net.Sockets.TcpListener(localAddr, port)
'to
Dim server As New System.Net.Sockets.TcpListener(IPAddress.Any, port)
you are currently only listening on the 127.0.0.1 address rather than your real network address.