程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> 窗體-進銷存管理系統C#中,什麼存在二義性,inputDataGridArray[0]這裡不懂怎麼改

窗體-進銷存管理系統C#中,什麼存在二義性,inputDataGridArray[0]這裡不懂怎麼改

編輯:編程綜合問答
進銷存管理系統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鍵,跳到下一控件
}

最佳回答:


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

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

同一個變量你定義了2次,你應該刪除其中之一。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved