| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 969 人关注过本帖
标题:请各位师兄师姐们看看这段代码该怎样解决?
只看楼主 加入收藏
hissbblove
Rank: 1
等 级:新手上路
帖 子:10
专家分:2
注 册:2010-4-24
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:5 
请各位师兄师姐们看看这段代码该怎样解决?
  这两处的错误提示如下:错误    1    应输入 class、delegate、enum、interface 或 struct    F:\csharp\lianxi\2\shop\shop\shop\frmCompanyInfo.cs    258    17    shop
错误    2    应输入 class、delegate、enum、interface 或 struct    F:\csharp\lianxi\2\shop\shop\shop\frmCompanyInfo.cs    285    17    shop
请问一下错误该怎样解决,错误的地方为:void,我已经上色了,在程序代码最后两段,谢谢大家了先。顺便说一声母亲节快乐,母亲吃得好、睡的香、身体倍儿棒、神采奕奕!

using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using shop.ClassInfo;
using shop.GoodMenhod;
using System.Data.SqlClient;

namespace shop
{
    public partial class frmCompanyInfo : Form
    {
        public frmCompanyInfo()
        {
            InitializeComponent();
        }

        public frmCompanyInfo(int intResult)
        {
            InitializeComponent();
            intReturn = intResult;
        }
        public static int intReturn = 0;
        tb_Company Company = new tb_Company();
        tb_CompanyMenthod CompanyMenthod = new tb_CompanyMenthod();
        tb_JhGoodsInfoMenthod jhgood = new tb_JhGoodsInfoMenthod();
        public static int intFalg = 0;
        private void ControlStatus()
        {
            this.toolSave.Enabled = !this.toolSave.Enabled;
            this.toolAdd.Enabled = !this.toolAdd.Enabled;
            this.toolCancel.Enabled = !this.toolCancel.Enabled;
            this.toolAmend.Enabled = !this.toolAmend.Enabled;
            this.toolrefesh.Enabled = !this.toolrefesh.Enabled;
        }

        /// <summary>
        /// 将控件恢复到原始状态
        /// </summary>
        private void ClearControls()
        {

            txtCompanyDirector.Text = "";
            txtCompanyAddress.Text = "";
            txtCompanyFax.Text = "";
            txtCompanyName.Text = "";
            txtCompanyPhone.Text = "";
            txtCompanyRemark.Text = "";

        }

        /// 控制控件状态
        /// </summary>

        public int GetCount()
        {
            int intReslult = 0;
            if (intFalg == 1 || intFalg == 2)
            {
                if (txtCompanyName.Text == "")
                {
                    MessageBox.Show("供应商名称不能为空!", "提示");
                    return intReslult;
                }
                if (txtCompanyPhone.Text == "")
                {
                    MessageBox.Show("联系电话不能为空!", "提示");
                    return intReslult;
                }
                if (txtCompanyDirector.Text == "")
                {
                    MessageBox.Show("地址不能为空!", "提示");
                    return intReslult;
                }
                if (intFalg != 2)
                {
                    Company.intCompanyID = CompanyMenthod.tb_CustomerID();
                }
                else
                {
                    Company.intCompanyID = this.dataGridView1[0, this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
                }
                Company.intEmpFalg = 0;
                Company.strCompanyAddress = txtCompanyAddress.Text;
                Company.strCompanyDirector = txtCompanyDirector.Text;
                Company.strCompanyFax = txtCompanyFax.Text;
                Company.strCompanyName = txtCompanyName.Text;
                Company.strCompanyPhone = txtCompanyPhone.Text;
                Company.strCompanyRemark = txtCompanyRemark.Text;
                Company.daReDateTime = DateTime.Now;
            }
            if (intFalg == 3)
            {
                if (txtCompanyName.Text == "")
                {
                    MessageBox.Show("供应商名称不能为空!请选择要删除的的记录", "提示");
                    return intReslult;
                }
                Company.intEmpFalg = 1;
                Company.intCompanyID = this.dataGridView1[0, this.dataGridView1.CurrentCell.RowIndex].Value.ToString();

            }

            intReslult = 1;
            return intReslult;

        }

        private void frmCompanyInfo_Load(object sender, EventArgs e)
        {
            CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
        }

        private void toolExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void toolsave_Click(object sender, EventArgs e)
        {
            if (GetCount() == 1)
            {
                if (intFalg == 1)
                {
                    if (CompanyMenthod.tb_CompanyMenthodAdd(Company) == 1)
                    {
                        if (intReturn == 1)
                        {
                            frmGonYingShang frmCop = (frmGonYingShang)this.Owner;
                            jhgood.filltProd(frmCop.treeView1, frmCop.imageList1);
                            ClearControls();
                            ControlStatus();
                            intFalg = 0;
                            this.Close();


                        }
                        MessageBox.Show("添加成功");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();

                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();
                    }

                }
                if (intFalg == 2)
                {
                    if (CompanyMenthod.tb_CompanyMenthodUpDate(Company) == 1)
                    {
                        MessageBox.Show("修改成功");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();
                    }

                }
                if (intFalg == 3)
                {
                    if (CompanyMenthod.tb_CompanyMenthodDelete(Company) == 1)
                    {
                        MessageBox.Show("删除成功");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();
                    }
                    else
                    {
                        MessageBox.Show("删除失败");
                        intFalg = 0;
                        CompanyMenthod.tb_CompanyFind("", 3, dataGridView1);
                        ClearControls();
                        ControlStatus();
                    }

                }


            }//
        }
        private void FillControls()
        {
            try
            {
                SqlDataReader sqldr = CompanyMenthod.tb_CompanyFind(this.dataGridView1[0, this.dataGridView1.CurrentCell.RowIndex].Value.ToString());

                sqldr.Read();
                if (sqldr.HasRows)
                {
                    txtCompanyName.Text = sqldr[1].ToString();
                    txtCompanyDirector.Text = sqldr[2].ToString();
                    txtCompanyPhone.Text = sqldr[3].ToString();
                    txtCompanyFax.Text = sqldr[4].ToString();
                    txtCompanyAddress.Text = sqldr[5].ToString();
                    txtCompanyRemark.Text = sqldr[6].ToString();

                }


            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());

            }
        }

        private void toolCancel_Click(object sender, EventArgs e)
        {
            ClearControls();
            ControlStatus();
            intFalg = 0; //取消标记
        }

        private void toolAdd_Click(object sender, EventArgs e)
        {
            ControlStatus();
            ClearControls();
            intFalg = 1;//添加标记
        }

        private void toolAmend_Click(object sender, EventArgs e)
        {
            ControlStatus();
            ClearControls();
            intFalg = 2;//修改标记
        }

        private void toolrefesh_Click(object sender, EventArgs e)
        {
             ControlStatus();
            intFalg = 3;//删除标记
        }
        }
private void txtOK_Click(object sender, EventArgs e)
        {   
            string P_Str_cmdtxt = String.Empty;
            string P_Str_selectcondition = this.cbxCondition.Text;
            if (P_Str_selectcondition == null)
            {
                MessageBox.Show("请选择查询条件!");
                return;
            }
            if (this.txtKeyWord.Text == "")
            {
                MessageBox.Show("输入查询条件!");
                return;
            }
            switch (P_Str_selectcondition)
            {
                case "供应商名称":
                    CompanyMenthod.tb_CompanyFind(txtKeyWord.Text, 1, dataGridView1);
                    break;
                case "负责人姓名":
                    CompanyMenthod.tb_CompanyFind(txtKeyWord.Text, 2, dataGridView1);
                    break;
                default:
                    break;
            }
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (intFalg == 2 || intFalg == 3)
            {
                FillControls();
            }
        }
搜索更多相关主题的帖子: 师姐 师兄 代码 
2010-05-09 22:35
封闭
Rank: 9Rank: 9Rank: 9
来 自:广东省汕头市
等 级:蜘蛛侠
威 望:1
帖 子:501
专家分:1084
注 册:2007-9-14
收藏
得分:2 
看起来好象没什么问题。

不然楼主把整个程序附件发上来吧。
2010-05-09 23:35
athenalux
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:河北石家庄
等 级:小飞侠
威 望:8
帖 子:975
专家分:2514
注 册:2008-11-26
收藏
得分:18 
看一下,错误前面的语句是不是多了个“}”。


[ 本帖最后由 athenalux 于 2010-5-10 07:27 编辑 ]

QQ:81704464
2010-05-10 05:50
hissbblove
Rank: 1
等 级:新手上路
帖 子:10
专家分:2
注 册:2010-4-24
收藏
得分:0 
   额,是多了一个“}”,最后又调试了一下别的代码还有问题,正在整改中,谢谢你们了额、、、
2010-05-10 11:06
Alar30
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:10
帖 子:988
专家分:1627
注 册:2009-9-8
收藏
得分:0 
恭喜LZ找到问题
呵呵
2010-05-10 11:23
dubaokun
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2010-4-14
收藏
得分:0 
看不懂,在此学习一下
2010-05-11 09:28
快速回复:请各位师兄师姐们看看这段代码该怎样解决?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.046586 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved