出错提示:不包含适合于入口点的静态“Main”方法
using System;using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Runtime.Serialization.Formatters.Binary;
using System.Net;
using System.Collections;
namespace Login
{
public partial class frmLogin : DevComponents.DotNetBar.Office2007Form
{
public NetworkStream _ns = null; //网络流
public int MyAccounts; //登录者的帐号
public int portNum; //登录者监听的端口号
public frmLogin(int portNum)
{
InitializeComponent();
this.portNum = portNum;
}
private void 登录框_Load(object sender, EventArgs e)
{
}
private void butLogin_Click_1(object sender, EventArgs e)
{
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;
}
string strIP = Dns.Resolve(Dns.GetHostName()).AddressList[0].ToString();
//连接服务器
TcpClient _serverSocket = new TcpClient(strIP, 8888);
//获取网络流
this._ns = _serverSocket.GetStream();
LoginUserInfoVO.LoginUserInfo userInfo = new LoginUserInfoVO.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";
//格式器
BinaryFormatter formater = new BinaryFormatter();
//把对客户端对象序列化到流中
formater.Serialize(this._ns, userInfo);
//从流中反序列化对象
LoginUserInfoVO.LoginUserInfo returnUser = (LoginUserInfoVO.LoginUserInfo)formater.Deserialize(this._ns);
//判断帐号是否正确
if (returnUser.LoginState == 1)
{
MessageBox.Show("密码或帐号错误~!!");
return;
}
if (returnUser.LoginState == 0)
{
//开启主界面
Form2 main = new Form2(this, returnUser.AryFellowList, this.portNum);
//开启广播通知
frmWelcomeTip welcome = new frmWelcomeTip();
welcome.labTitleAccounts.Text = "系统消息:";
welcome.labWelcomeWord.Text = this.textUserID.Text + "\n您好!欢迎您的登录~!";
welcome.Show();
main.Show();
//this.Hide();
}
}
private void butCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void textUserID_KeyDown_1(object sender, KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
this.textPassword.Focus();
}
private void textPassword_KeyDown_1(object sender, KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
this.butLogin.Focus();
}
//注册帐号的链接
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmRegister register = new frmRegister();
register.ShowDialog();
}
}
}
提示 错误 7 程序“C:\Documents and Settings\Administrator\桌面\Login 918\Login\obj\Debug\Login.exe”不包含适合于入口点的静态“Main”方法 Login
--------------------编程问答-------------------- 这是说你的整个项目内的所有文件中没有一个类里有一个静态方法签名符合Main函数的要求。 --------------------编程问答-------------------- xuexue~~~~~~~~~~~~~~
--------------------编程问答-------------------- 咋解决
补充:.NET技术 , C#