private void button2_Click(object sender, EventArgs e) { client.BeginLogin(ar => { var a = (NCAsyncResult)ar; if (a.BaseResult == baseResult.Successful) { client.BeginConnectOMCS(iar => { showResult((IResult)iar); Invoke(new Action(() => { label3.Text = "id:0000"; })); }, ConfigurationManager.AppSettings["OMCSIP"], int.Parse(ConfigurationManager.AppSettings["OMCSPORT"]), this.cameraConnector1, this.whiteBoardConnector1); } } , "0000", "123456", null); }