SoFunction
Updated on 2025-04-06

Bind DataGrid in winform


["ID"].DataPropertyName = "ID";
            ["TankName"].DataPropertyName = "Name";
            ["Area"].DataPropertyName = "Area";
            ["Type"].DataPropertyName = "Type";
            ["Status"].DataPropertyName = "Status";
            ["Material"].DataPropertyName = "Material";
            ["MaterialCategory"].DataPropertyName = "MaterialCategory";
            ["MaxLevel"].DataPropertyName = "MaxLevel";
            ["MinLevel"].DataPropertyName = "MinLevel";
            ["MaxCapacity"].DataPropertyName = "MaxCapacity";
            ["MinCapacity"].DataPropertyName = "MinCapacity";
            ["Code"].DataPropertyName = "Code";

            ////set columns width
            //["MaterialCategory"].Width = 80;
            //["Material"].Width = 240;
            //["TankName"].Width = 100;
            //["Area"].Width = 80;
            //["MaxLevel"].Width = 100;
            //["MinLevel"].Width = 100;
            //["MaxCapacity"].Width = 100;
            //["MinCapacity"].Width = 100;
            //["Type"].Width = 60;

            //["Status"].AutoSizeMode = ;

  = false;
            = tankviews;
            int rowCount = ;
            if (SelectedIndex < rowCount || SelectedIndex >= rowCount)
            {
                [0].Selected = true;
            }
            else
            {
                [].Selected = true;
            }


  for (int i = 0; i < ; i++)
            {
                if (([i].Cells["ColumnSelectedMinRatio"].()) > ([i].Cells["ColumnSelectedMaxRatio"].()))
                {
                    (([((int)), "1959"].ToString(), [i].Cells["ColumnSelectedName"].()));
                    return false;
                }
            }


RowHeardersVisible=false
Selection Mode=Full row Select
ColumnHeaderDefault=alignCenter

///high
= 40;
= ;

Width:
  = false;
            = ;
            ["ColumnMaterialTankName"].Width = 80;

----------------------------------------------------------

this.;  //The value of the currently active cell

this.;//The row of the currently active cell

this.;//The column where the currently active cell is located

this.[5].Cells[3].Value;//The value of the cell located in row 6 and column 4
DataGridView[col,row].Value=obj;

   (dgrdBlendMaterial);
            = false;
            = ;
            ["ColumnMaterialName"].Width = 200;

      ("PageIndex", tankListModel, "PageIndex", true, );

-----The display format of a column---
["ColumnTimeStamp"]. = ;

---Get the value of a selected column -----
strCurRoleID = [0].Cells[0].();