sinat_25045939 2015-01-04 09:24 采纳率: 66.7%
浏览 2018
已采纳

进销存管理系统C#中,什么存在二义性,inputDataGridArray[0]这里不懂怎么改

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;

namespace 进销存管理系统
{
public partial class StockTable : Form
{
private LinkDataBase link = new LinkDataBase();
private DataTable newTable;
//保存从”供货商信息维护”窗体中选择后传过来的数据,它们将被放入DataGrid的相 应表格中
public static string[] inputDataGridArray = new string[]{null,null,null};
//保存从”供货商信息维护”窗体中选择后传过来的数据,它们将被赋值给供货商号和名称
//的控件Text属性
//确定要赋的值为文本,故用空字符初始化
public static string[] inputDataGridArray = new string[] {"",""};
private DateTime gridMouseDownTime;//记录单击DateGrid时的时间

    public StockTable()
    {
        InitializeComponent();
         this.selectDataBase();
         this.DataGridStateControl();
         this.cmb_StokerID.Items.Add("");
    }
    public void setWareData()
    {

dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,0]=inputDataGridArray[0];
dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,4]=inputDataGridArray[1];
dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,5]=inputDataGridArray[2];
dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,7]=17;

    }
    private void setTextData()
    {
        this .cmb_StokerID.IntegralHeight = false;
        this .cmb_StokerID.DroppedDown = false;
        this .cmb_StokerID.Items[0] = inputDataGridArray[0];
        this .cmb_StokerID.SelectedIndex= 0;
        this.txt_StokerName.Text= inputDataGridArray [1];
        this .cmb_StokerID.IntegralHeight = true ;
     }


      private void selectDataBase()
     {
        this .txt_StockDate.Text = System .DateTime .Today.ToShortDateString ();
        string tempStrSQL = "select distinct 姓名from 用户清单";
        DataTable  tempDataTable = link.SelectDataBase(tempStrSQL);
        for (int i =0;i<tempDataTable .Rows .Count ;i++)
             this .cmb_Oprater.Items.Add(tempDataTable.Rows [i][0]);
         this.cmb_Oprater.SelectedIndex = 0;
     }

    private void DataGridStateControl()
 {
     newTable = new DataTable ();
     newTable.Columns.Add("货号(双击)",typeof (string ));
     newTable.Columns.Add("数量",typeof (decimal  ));
     newTable.Columns.Add("单价",typeof (decimal  ));
     newTable.Columns.Add("仓库",typeof(string  ));
     newTable.Columns.Add("品名",typeof (string   ));
     newTable.Columns.Add("单位",typeof (string   ));
     newTable.Columns.Add("金额",typeof (decimal  ),"数量单价?");

     newTable.Columns.Add("税率",typeof (decimal  ));
     newTable.Columns.Add("不含税额",typeof (decimal  ),"金额/1.17"); 
     newTable.Columns.Add("税额",typeof (decimal  ),"金额-不含税额");

        this .dgrd_StockTable.DataSource= newTable;
        newTable.Rows.Add(newTable.NewRow());
        DataGridTableStyle ts = new DataGridTableStyle ();
        DataGridTextBoxColumn aColumnTextColumn;
        ts.AllowSorting = false ;
        ts.AlternatingBackColor = Color .LightGray ;
        ts.MappingName = newTable.TableName;
        int numCols = newTable.Columns.Count;
        for (int i =0;i <numCols ;i++)
        {
        aColumnTextColumn  = new DataGridTextBoxColumn ();
            if (i!=0&&i!=1&&i!=2&&i!=3)
            {
            aColumnTextColumn .ReadOnly  = true ;

            }
        if (i==0)
        {
        aColumnTextColumn .TextBox .MouseDown += new MouseEventHandler
            (TextBoxMouseDownHandler);
        }
            if (i==4)
            {
            aColumnTextColumn .Width =160;
            }
        if (i==3)
        {
        string sendStrSQL ="select distinct仓库from 库存库a order by 仓库ASC";
            DataTable tempTable = this .link.SelectDataBase(sendStrSQL );
        }
        else 
        {
        aColumnTextColumn .MappingName = newTable.Columns[i].ColumnName;
        aColumnTextColumn .HeaderText = newTable.Columns[i].ColumnName;
        aColumnTextColumn .NullText= "";
            aColumnTextColumn .Format= "N";
            ts .GridColumnStyles.Add(aColumnTextColumn );

        }

      }
        this .dgrd_StockTable.TableStyles.Add(ts);

    }

    private void toolBar1_Button_Click(object sender,System .Windows .Forms .
        ToolBarButtonClickEventArgs  e)
    {
    if (e.Button .ToolTipText =="保存修改?")
    {
        clickedSaveIcon(); 
    }
    else if (e.Button .ToolTipText =="删除数据")
    {
       try 
       {
          if (newTable.Rows.Count>0)
          {
              this .newTable.Rows.RemoveAt(this .dgrd_StockTable.CurrentCell.RowNumber);
                   this .controlCalculate();
           }

          if (newTable.Rows.Count-1<=0)

             newTable.Rows.Add(newTable.NewRow());
       }
         catch
        {
           return;
        }
    }
    else if (e.Button.ToolTipText==" 打印报表")
    {
        }

}
//------------创建窗体,共用户选择供货商------------
private void cmd_Stoker_DropDown(object sender ,System.EventArgs e)
{
StokerDataManage newFrm= new StokerDataManage();
newFrm.setDataGridReadOnly();
newFrm.ShowDialog();
setTextData();
SendKeys.Send("{Tab}"); //向活动应用程序发送Tab键,跳到下一控件
}

  • 写回答

1条回答 默认 最新

  • threenewbee 2015-01-04 10:21
    关注

    public static string[] inputDataGridArray = new string[]{null,null,null};

    public static string[] inputDataGridArray = new string[] {"",""};

    同一个变量你定义了2次,你应该删除其中之一。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。