I need to do a simple drag and drop procedure, but I dont know why this code isn´t working...
/// Interaction logic for MainWindow.xaml
public partial class MainWindow : Window
throw; // this rethrows the caugh exception.
// here you will get the same exception as you got in the// other catch.// Note that I used throw; to rethrow the exception. If on the// other catch I did a throw exception; I would end-up replacing// the stored callstack (that's usually a bad thing).
Note: You can also avoid catching the exception by putting a more specific type in the first catch (like IOException instead of Exception).
Hey folks!! Hope you can help me with my client code.
Först I debugg the Server wich is an consoleapplication and the server starts, secondly I debugg the Client, I put a nickname value to the nickNameTextBox and click on Connect (button2) the compiler stops at this code line
from the button 2 handler - unless you have pressed Button1 first, the connection has not been established and it will likely throw an exception - probably the one you are complaining about.
Personally, I would have a "Connect" method, which checked if you are connected and does so if not - and call it from both click events. (I would probably also make it return the stream instead of using a class level variable directly in the two event handlers).
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
Thank you mate I appreciate your help, I changed it to this code,
the reason I commented out
because the compiler stops there when I debugg telling me that a socket is already connected, now the compiler runs withour errors but the server consoleAppplication doesn't receive any msg at all when I send it from sendTextBox..
privatevoid button1_Click(object sender, EventArgs e)
if (serverStream == null)
MessageBox.Show("Please connect to a server.");
readData = "Conected to Chat Server ...";
serverStream = clientSocket.GetStream();
byte outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
Thread ctThread = new Thread(getMessage);
The compiler stops on this code under the getMessage method
"Failed to read data from the transport connection: An existing connection was forced to close by the remote host." It havens because I closed the Server... Anyway this project is driving me crazy man I can't see why it's not working and the Server doesn't get and show the string on the server prompt from the Client
I am going to write a C# 2010 application as a console application to start with. Eventually I will change the application to compile as a windows application so I do not get the dos pop windows. When this application goes into production, it will be executed by a windows scheduler. My question is the best way to pass parameters to this application.
Thus can you show me the following:
1. Code on how to accept values from parameters?
2. When the application runs as an executable, can you show me in code how to pass the values to this executable?
I see the others have you given you plenty to read regarding the parsing of parameters, so I will just add that it would be best to do ONLY the parsing of parameters and possibly writing of the help text in the Console application and put all actual program logic in a dll. That way you can plug any interface you want into your app: console window, windows UI, WPF, Web Service or whatever.
Last Visit: 31-Dec-99 18:00 Last Update: 27-Jun-17 11:17