问题描述
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Net.Sockets;usingSystem.Runtime.Serialization.Formatters.Binary;usingSystem.Net;usingSystem.Collections;namespaceLogin{publicpartialclassfrmLogin:DevComponents.DotNetBar.Office2007Form{publicNetworkStream_ns=null;//网络流publicintMyAccounts;//登录者的帐号publicintportNum;//登录者监听的端口号publicfrmLogin(intportNum){InitializeComponent();this.portNum=portNum;}privatevoid登录框_Load(objectsender,EventArgse){}privatevoidbutLogin_Click_1(objectsender,EventArgse){if(this.textUserID.Text.Trim()==""){this.balloonTip1.SetBalloonCaption(this.textUserID,"提示");this.balloonTip1.SetBalloonText(this.textUserID,"请输入用户名。");this.balloonTip1.ShowBalloon(this.textUserID);return;}if(this.textPassword.Text.Trim()==""){this.balloonTip1.SetBalloonCaption(this.textPassword,"提示");this.balloonTip1.SetBalloonText(this.textPassword,"请输入密码。");this.balloonTip1.ShowBalloon(this.textPassword);return;}stringstrIP=Dns.Resolve(Dns.GetHostName()).AddressList[0].ToString();//连接服务器TcpClient_serverSocket=newTcpClient(strIP,8888);//获取网络流this._ns=_serverSocket.GetStream();LoginUserInfoVO.LoginUserInfouserInfo=newLoginUserInfoVO.LoginUserInfo();try{this.MyAccounts=int.Parse(this.textUserID.Text.Trim());userInfo.LoginAccounts=this.MyAccounts;userInfo.PortNum=this.portNum;}catch{MessageBox.Show("帐号必须为数字~!");}userInfo.LoginPassWord=this.textPassword.Text;//获得本机的IP地址userInfo.LoginIP=Dns.Resolve(Dns.GetHostName()).AddressList[0].ToString();userInfo.Flag="Login";//格式器BinaryFormatterformater=newBinaryFormatter();//把对客户端对象序列化到流中formater.Serialize(this._ns,userInfo);//从流中反序列化对象LoginUserInfoVO.LoginUserInforeturnUser=(LoginUserInfoVO.LoginUserInfo)formater.Deserialize(this._ns);//判断帐号是否正确if(returnUser.LoginState==1){MessageBox.Show("密码或帐号错误~!!");return;}if(returnUser.LoginState==0){//开启主界面Form2main=newForm2(this,returnUser.AryFellowList,this.portNum);//开启广播通知frmWelcomeTipwelcome=newfrmWelcomeTip();welcome.labTitleAccounts.Text="系统消息:";welcome.labWelcomeWord.Text=this.textUserID.Text+"n您好!欢迎您的登录~!";welcome.Show();main.Show();//this.Hide();}}privatevoidbutCancel_Click(objectsender,EventArgse){this.Close();}privatevoidtextUserID_KeyDown_1(objectsender,KeyEventArgse){if(e.KeyCode==System.Windows.Forms.Keys.Enter)this.textPassword.Focus();}privatevoidtextPassword_KeyDown_1(objectsender,KeyEventArgse){if(e.KeyCode==System.Windows.Forms.Keys.Enter)this.butLogin.Focus();}//注册帐号的链接privatevoidlinkLabel1_LinkClicked(objectsender,LinkLabelLinkClickedEventArgse){frmRegisterregister=newfrmRegister();register.ShowDialog();}}}提示错误7程序“C:DocumentsandSettingsAdministrator桌面Login918LoginobjDebugLogin.exe”不包含适合于入口点的静态“Main”方法Login
解决方案
解决方案二:
这是说你的整个项目内的所有文件中没有一个类里有一个静态方法签名符合Main函数的要求。
解决方案三:
xuexue~~~~~~~~~~~~~~
解决方案四:
咋解决