thinking the same example; suppose that both client and server windows forms
"Lars-Inge Tønnessen [VJ# MVP]" wrote:
>
> You can't do that. You are running your code on the main thread. That means
> the code is running in a sequence. Line 1 runs before line 2 and so on.
> Please move your code to after the :
>
> // TODO: Add any constructor code after InitializeComponent call
>
>
>
> I would recommend a J# book:
>
>
http://www.microsoft.com/learning/books/devtools/vstudio.net/vjsharp.net/
>
>
http://www.microsoft.com/mspress/books/5834.asp >
>
> The example:
>
>
> package WindowsApplication3;
>
> import System.Drawing.*;
> import System.Collections.*;
> import System.ComponentModel.*;
> import System.Windows.Forms.*;
> import System.Data.*;
>
> /**
> * Summary description for Form1.
> */
> public class Form1 extends System.Windows.Forms.Form
> {
> /**
> * Required designer variable.
> */
> private System.ComponentModel.Container components = null;
>
> public Form1()
> {
> //
> // Required for Windows Form Designer support
> //
> InitializeComponent();
>
> //
> // TODO: Add any constructor code after InitializeComponent call
> //
> // YOUR CODE HERE
> server=new ServerSocket(15);
> nextClient=server.accept();
> txtConnection.set_Text("Kuruldu!");
> }
>
> /**
> * Clean up any resources being used.
> */
> protected void Dispose(boolean disposing)
> {
> if (disposing)
> {
> if (components != null)
> {
> components.Dispose();
> }
> }
> super.Dispose(disposing);
> }
>
> #region Windows Form Designer generated code
> /**
> * Required method for Designer support - do not modify
> * the contents of this method with the code editor.
> */
> private void InitializeComponent()
> {
> this.components = new System.ComponentModel.Container();
> this.set_Size(new System.Drawing.Size(300,300));
> this.set_Text("Form1");
> }
> #endregion
>
> /**
> * The main entry point for the application.
> */
> /** @attribute System.STAThread() */
> public static void main(String[] args)
> {
> Application.Run(new Form1());
> }
> }
>
>
>
> Regards,
> Lars-Inge Tønnessen
>
>