Ejemplo n.º 1
0
        /// <summary>
        /// Handle event CheckedChanged of chkCheck. Check or Uncheck all CheckBox of selected row in datagrid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// Author:			PhatLT. FPTSS.
        /// Created date:	14/02/2011
        /// </remarks>
        private void chkSelected_CheckedChanged(object sender, System.EventArgs e)
        {
            if (dt == null)
            {
                return;
            }

            string value = "";

            if (chkSelected.Checked)
            {
                value = "1";
            }
            else
            {
                value = "0";
            }

            grd.BeginInit();
            dt.BeginInit();

            DataView view  = dt.DefaultView;
            int      count = view.Count;

            for (int i = 0; i < count; i++)
            {
                if (grd.IsSelected(i))
                {
                    view[i].Row["Selected"] = value;
                }
            }

            dt.EndInit();
            grd.EndInit();
        }
Ejemplo n.º 2
0
 ///	<summary>
 ///	Construct the window.
 ///	</summary>
 ///	<remarks>
 ///	This method	constructs the window by creating both the data	grid and the button.
 ///	</remarks>
 public DisplayTabularData(	)
 {
     this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
     this.ClientSize	= new System.Drawing.Size (464,	253);
     this.Text =	"01_DisplayTabularData" ;
     this.dataGrid =	new	System.Windows.Forms.DataGrid ();
     dataGrid.BeginInit ();
     dataGrid.Location =	new	System.Drawing.Point (8, 8);
     dataGrid.Size =	new	System.Drawing.Size	(448, 208);
     dataGrid.TabIndex =	0;
     dataGrid.Anchor	= AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
     this.Controls.Add (this.dataGrid);
     dataGrid.EndInit ();
     this.retrieveButton	= new System.Windows.Forms.Button ();
     retrieveButton.Location	= new System.Drawing.Point (384, 224);
     retrieveButton.Size	= new System.Drawing.Size (75, 23);
     retrieveButton.TabIndex	= 1;
     retrieveButton.Anchor =	AnchorStyles.Bottom | AnchorStyles.Right ;
     retrieveButton.Text	= "Retrieve";
     retrieveButton.Click +=	new	System.EventHandler	(this.retrieveButton_Click);
     this.Controls.Add (this.retrieveButton);
 }
Ejemplo n.º 3
0
 ///	<summary>
 ///	Construct the window.
 ///	</summary>
 ///	<remarks>
 ///	This method	constructs the window by creating both the data	grid and the button.
 ///	</remarks>
 public DataSourceDataSet(      )
 {
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(464, 253);
     this.Text     = "05_DataSourceDataSet";
     this.dataGrid = new     System.Windows.Forms.DataGrid();
     dataGrid.BeginInit();
     dataGrid.Location = new     System.Drawing.Point(8, 8);
     dataGrid.Size     = new     System.Drawing.Size(448, 208);
     dataGrid.TabIndex = 0;
     dataGrid.Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
     this.Controls.Add(this.dataGrid);
     dataGrid.EndInit();
     this.retrieveButton     = new System.Windows.Forms.Button();
     retrieveButton.Location = new System.Drawing.Point(384, 224);
     retrieveButton.Size     = new System.Drawing.Size(75, 23);
     retrieveButton.TabIndex = 1;
     retrieveButton.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
     retrieveButton.Text     = "Retrieve";
     retrieveButton.Click   += new     System.EventHandler(this.retrieveButton_Click);
     this.Controls.Add(this.retrieveButton);
 }
Ejemplo n.º 4
0
    ///	<summary>
    ///	Construct the window.
    ///	</summary>
    ///	<remarks>
    ///	This method	constructs the window by creating both the data	grid and the button.
    ///	</remarks>
    public DataSourceDataView(     )
    {
        /*		this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
         *              this.ClientSize	= new System.Drawing.Size (464,	253);
         *              this.Text =	"04_DataSourceDataView" ;
         *              this.dataGrid =	new	System.Windows.Forms.DataGrid ();
         *              dataGrid.BeginInit ();
         *              dataGrid.Location =	new	System.Drawing.Point (8, 8);
         *              dataGrid.Size =	new	System.Drawing.Size	(448, 208);
         *              dataGrid.TabIndex =	0;
         *              dataGrid.Anchor	= AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
         *              this.Controls.Add (this.dataGrid);
         *              dataGrid.EndInit ();
         *              this.retrieveButton	= new System.Windows.Forms.Button ();
         *              retrieveButton.Location	= new System.Drawing.Point (384, 224);
         *              retrieveButton.Size	= new System.Drawing.Size (75, 23);
         *              retrieveButton.TabIndex	= 1;
         *              retrieveButton.Anchor =	AnchorStyles.Bottom | AnchorStyles.Right ;
         *              retrieveButton.Text	= "Retrieve";
         *              retrieveButton.Click +=	new	System.EventHandler	(this.retrieveButton_Click);
         *              this.Controls.Add (this.retrieveButton); */

        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
        this.ClientSize        = new System.Drawing.Size(464, 493);
        this.Text     = "04_DataSourceDataView";
        this.dataGrid = new System.Windows.Forms.DataGrid();
        dataGrid.BeginInit();
        dataGrid.CaptionText = "From Database";
        dataGrid.Font        = new System.Drawing.Font("Tahoma", 8);
        dataGrid.Location    = new System.Drawing.Point(8, 8);
        dataGrid.Size        = new System.Drawing.Size(448, 208);
        dataGrid.TabIndex    = 0;
        dataGrid.Anchor      = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
        this.Controls.Add(this.dataGrid);
        dataGrid.EndInit();

        this.retrieveButton     = new System.Windows.Forms.Button();
        retrieveButton.Location = new System.Drawing.Point(8, 224);
        retrieveButton.Size     = new System.Drawing.Size(75, 23);
        retrieveButton.TabIndex = 1;
        retrieveButton.Anchor   = AnchorStyles.Top | AnchorStyles.Left;
        retrieveButton.Text     = "Retrieve";
        retrieveButton.Click   += new System.EventHandler(this.retrieveButton_Click);
        this.Controls.Add(this.retrieveButton);

        this.comboBox1                  = new System.Windows.Forms.ComboBox();
        comboBox1.Location              = new System.Drawing.Point(96, 224);
        comboBox1.Size                  = new System.Drawing.Size(360, 21);
        comboBox1.DropDownStyle         = ComboBoxStyle.DropDownList;
        comboBox1.TabIndex              = 2;
        comboBox1.Anchor                = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
        comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
        comboBox1.Items.AddRange(new object[8] {
            "Added", "CurrentRows", "Deleted", "ModifiedCurrent", "ModifiedOriginal", "None", "OriginalRows", "Unchanged"
        });
        this.Controls.Add(this.comboBox1);

        this.dataGrid2 = new System.Windows.Forms.DataGrid();
        dataGrid2.BeginInit();
        dataGrid2.Location    = new System.Drawing.Point(8, 256);
        dataGrid2.Size        = new System.Drawing.Size(448, 232);
        dataGrid2.DataMember  = "";
        dataGrid2.CaptionText = "Filtered";
        dataGrid2.Font        = new System.Drawing.Font("Tahoma", 8);
        dataGrid2.TabIndex    = 3;
        dataGrid2.Anchor      = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
        this.Controls.Add(this.dataGrid2);
        dataGrid2.EndInit();
    }
Ejemplo n.º 5
0
 private void DataGridResize(ref DataGrid grd, int iColumnCount)
 {
     grd.BeginInit();
     foreach(DataGridTableStyle grdStyle in grd.TableStyles)
     {
         try
         {
             int width = grd.Width - 56;//53;//real is 56
             GridColumnStylesCollection cols = grdStyle.GridColumnStyles;
             int oldwidth = 0;
             for(byte i =0;i <iColumnCount;i++)
             {
                 oldwidth = oldwidth +cols[i].Width;// col.Width;
             }
             if(oldwidth == 0)
                 return;
             int count = grdStyle.GridColumnStyles.Count;
             double scale = 1.0*width/oldwidth;
             foreach(DataGridColumnStyle col in cols)
             {
                 col.Width = (int)(col.Width * scale);
             }
         }
         catch(Exception ex)
         {
             log.Error(ex.Message,ex);
         }
     }
     grd.EndInit();
 }
Ejemplo n.º 6
0
    ///	<summary>
    ///	Construct the window.
    ///	</summary>
    ///	<remarks>
    ///	This method	constructs the window by creating both the data	grid and the button.
    ///	</remarks>
    public DataSourceDataView(	)
    {
        /*		this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
                this.ClientSize	= new System.Drawing.Size (464,	253);
                this.Text =	"04_DataSourceDataView" ;
                this.dataGrid =	new	System.Windows.Forms.DataGrid ();
                dataGrid.BeginInit ();
                dataGrid.Location =	new	System.Drawing.Point (8, 8);
                dataGrid.Size =	new	System.Drawing.Size	(448, 208);
                dataGrid.TabIndex =	0;
                dataGrid.Anchor	= AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
                this.Controls.Add (this.dataGrid);
                dataGrid.EndInit ();
                this.retrieveButton	= new System.Windows.Forms.Button ();
                retrieveButton.Location	= new System.Drawing.Point (384, 224);
                retrieveButton.Size	= new System.Drawing.Size (75, 23);
                retrieveButton.TabIndex	= 1;
                retrieveButton.Anchor =	AnchorStyles.Bottom | AnchorStyles.Right ;
                retrieveButton.Text	= "Retrieve";
                retrieveButton.Click +=	new	System.EventHandler	(this.retrieveButton_Click);
                this.Controls.Add (this.retrieveButton); */

        this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
        this.ClientSize = new System.Drawing.Size (464, 493);
        this.Text = "04_DataSourceDataView" ;
        this.dataGrid = new System.Windows.Forms.DataGrid ();
        dataGrid.BeginInit ();
        dataGrid.CaptionText = "From Database";
        dataGrid.Font = new System.Drawing.Font ("Tahoma", 8);
        dataGrid.Location = new System.Drawing.Point (8, 8);
        dataGrid.Size = new System.Drawing.Size (448, 208);
        dataGrid.TabIndex = 0;
        dataGrid.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
        this.Controls.Add (this.dataGrid);
        dataGrid.EndInit ();

        this.retrieveButton = new System.Windows.Forms.Button ();
        retrieveButton.Location = new System.Drawing.Point (8, 224);
        retrieveButton.Size = new System.Drawing.Size (75, 23);
        retrieveButton.TabIndex = 1;
        retrieveButton.Anchor = AnchorStyles.Top | AnchorStyles.Left ;
        retrieveButton.Text = "Retrieve";
        retrieveButton.Click += new System.EventHandler (this.retrieveButton_Click);
        this.Controls.Add (this.retrieveButton);

        this.comboBox1 = new System.Windows.Forms.ComboBox ();
        comboBox1.Location = new System.Drawing.Point (96, 224);
        comboBox1.Size = new System.Drawing.Size (360, 21);
        comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
        comboBox1.TabIndex = 2;
        comboBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
        comboBox1.SelectedIndexChanged += new System.EventHandler (this.comboBox1_SelectedIndexChanged);
        comboBox1.Items.AddRange ( new object[8] { "Added" , "CurrentRows", "Deleted", "ModifiedCurrent", "ModifiedOriginal", "None", "OriginalRows", "Unchanged"} ) ;
        this.Controls.Add (this.comboBox1);

        this.dataGrid2 = new System.Windows.Forms.DataGrid ();
        dataGrid2.BeginInit ();
        dataGrid2.Location = new System.Drawing.Point (8, 256);
        dataGrid2.Size = new System.Drawing.Size (448, 232);
        dataGrid2.DataMember = "";
        dataGrid2.CaptionText = "Filtered";
        dataGrid2.Font = new System.Drawing.Font ("Tahoma", 8);
        dataGrid2.TabIndex = 3;
        dataGrid2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right ;
        this.Controls.Add (this.dataGrid2);
        dataGrid2.EndInit();
    }
Ejemplo n.º 7
0
 private void InitializeComponent()
 {
     this.components       = new System.ComponentModel.Container();
     this.btnGetChildRels  = new System.Windows.Forms.Button();
     this.btnGetInfo       = new System.Windows.Forms.Button();
     this.btnReadXML       = new System.Windows.Forms.Button();
     this.btnToXML         = new System.Windows.Forms.Button();
     this.txtCustID        = new System.Windows.Forms.TextBox();
     this.CarDataGrid      = new System.Windows.Forms.DataGrid();
     this.CustomerDataGrid = new System.Windows.Forms.DataGrid();
     CarDataGrid.BeginInit();
     CustomerDataGrid.BeginInit();
     btnGetChildRels.Location     = new System.Drawing.Point(200, 328);
     btnGetChildRels.Size         = new System.Drawing.Size(88, 56);
     btnGetChildRels.TabIndex     = 7;
     btnGetChildRels.Text         = "Get Child Relations for Orders Table";
     btnGetChildRels.Click       += new System.EventHandler(this.btnGetChildRels_Click);
     btnGetInfo.Location          = new System.Drawing.Point(296, 328);
     btnGetInfo.Size              = new System.Drawing.Size(88, 56);
     btnGetInfo.TabIndex          = 5;
     btnGetInfo.Text              = "Get Info for Cust ID:";
     btnGetInfo.Click            += new System.EventHandler(this.btnGetInfo_Click);
     btnReadXML.Location          = new System.Drawing.Point(112, 328);
     btnReadXML.Size              = new System.Drawing.Size(80, 56);
     btnReadXML.TabIndex          = 8;
     btnReadXML.Text              = "Rebuild DataSet from XML";
     btnReadXML.Click            += new System.EventHandler(this.btnReadXML_Click);
     btnToXML.Location            = new System.Drawing.Point(16, 328);
     btnToXML.Size                = new System.Drawing.Size(88, 56);
     btnToXML.TabIndex            = 4;
     btnToXML.Text                = "Write DataSet to XML";
     btnToXML.Click              += new System.EventHandler(this.btnToXML_Click);
     txtCustID.Location           = new System.Drawing.Point(392, 328);
     txtCustID.Text               = "1";
     txtCustID.TabIndex           = 6;
     txtCustID.Size               = new System.Drawing.Size(64, 20);
     CarDataGrid.Location         = new System.Drawing.Point(16, 16);
     CarDataGrid.Size             = new System.Drawing.Size(440, 152);
     CarDataGrid.DataMember       = "";
     CarDataGrid.CaptionText      = "Inventory";
     CarDataGrid.Font             = new System.Drawing.Font("Microsoft Sans Serif", 8);
     CarDataGrid.TabIndex         = 1;
     CarDataGrid.CaptionFont      = new System.Drawing.Font("Microsoft Sans Serif", 11, System.Drawing.FontStyle.Bold);
     CustomerDataGrid.Location    = new System.Drawing.Point(16, 184);
     CustomerDataGrid.Size        = new System.Drawing.Size(440, 120);
     CustomerDataGrid.DataMember  = "";
     CustomerDataGrid.CaptionText = "Customers";
     CustomerDataGrid.TabIndex    = 2;
     CustomerDataGrid.CaptionFont = new System.Drawing.Font("Microsoft Sans Serif", 11, System.Drawing.FontStyle.Bold);
     this.Text = "Car Data Table";
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.FormBorderStyle   = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.ClientSize        = new System.Drawing.Size(466, 399);
     this.Controls.Add(this.btnReadXML);
     this.Controls.Add(this.btnGetChildRels);
     this.Controls.Add(this.txtCustID);
     this.Controls.Add(this.btnGetInfo);
     this.Controls.Add(this.btnToXML);
     this.Controls.Add(this.CustomerDataGrid);
     this.Controls.Add(this.CarDataGrid);
     CarDataGrid.EndInit();
     CustomerDataGrid.EndInit();
 }
Ejemplo n.º 8
0
 private void InitializeComponent()
 {
     this.components       = new System.ComponentModel.Container();
     this.txtMake          = new System.Windows.Forms.TextBox();
     this.ColtsViewGrid    = new System.Windows.Forms.DataGrid();
     this.RedCarViewGrid   = new System.Windows.Forms.DataGrid();
     this.btnRemoveRow     = new System.Windows.Forms.Button();
     this.CarDataGrid      = new System.Windows.Forms.DataGrid();
     this.txtRemove        = new System.Windows.Forms.TextBox();
     this.btnGetMake       = new System.Windows.Forms.Button();
     this.btnChange        = new System.Windows.Forms.Button();
     this.btnMakeDataTable = new System.Windows.Forms.Button();
     ColtsViewGrid.BeginInit();
     RedCarViewGrid.BeginInit();
     CarDataGrid.BeginInit();
     //@this.TrayHeight = 0;
     //@this.TrayLargeIcon = false;
     //@this.TrayAutoArrange = true;
     txtMake.Location           = new System.Drawing.Point(128, 72);
     txtMake.TabIndex           = 3;
     txtMake.Size               = new System.Drawing.Size(80, 20);
     ColtsViewGrid.Location     = new System.Drawing.Point(16, 352);
     ColtsViewGrid.Size         = new System.Drawing.Size(440, 72);
     ColtsViewGrid.DataMember   = "";
     ColtsViewGrid.CaptionText  = "Only Colts View";
     ColtsViewGrid.TabIndex     = 8;
     ColtsViewGrid.CaptionFont  = new System.Drawing.Font("Microsoft Sans Serif", 10);
     RedCarViewGrid.Location    = new System.Drawing.Point(16, 272);
     RedCarViewGrid.Size        = new System.Drawing.Size(440, 72);
     RedCarViewGrid.DataMember  = "";
     RedCarViewGrid.CaptionText = "Only Red Cars View";
     RedCarViewGrid.TabIndex    = 7;
     RedCarViewGrid.CaptionFont = new System.Drawing.Font("Microsoft Sans Serif", 10);
     btnRemoveRow.Location      = new System.Drawing.Point(248, 64);
     btnRemoveRow.Size          = new System.Drawing.Size(112, 32);
     btnRemoveRow.TabIndex      = 4;
     btnRemoveRow.Text          = "Remove row #";
     btnRemoveRow.Click        += new System.EventHandler(this.btnRemoveRow_Click);
     CarDataGrid.Location       = new System.Drawing.Point(16, 128);
     CarDataGrid.Size           = new System.Drawing.Size(440, 136);
     CarDataGrid.DataMember     = "";
     CarDataGrid.CaptionText    = "All Cars (Default View)";
     CarDataGrid.TabIndex       = 1;
     CarDataGrid.CaptionFont    = new System.Drawing.Font("Microsoft Sans Serif", 10);
     txtRemove.Location         = new System.Drawing.Point(368, 72);
     txtRemove.TabIndex         = 5;
     txtRemove.Size             = new System.Drawing.Size(80, 20);
     btnGetMake.Location        = new System.Drawing.Point(8, 64);
     btnGetMake.Size            = new System.Drawing.Size(112, 32);
     btnGetMake.TabIndex        = 2;
     btnGetMake.Text            = "Get these makes:";
     btnGetMake.Click          += new System.EventHandler(this.btnGetMakes_Click);
     btnChange.Location         = new System.Drawing.Point(248, 16);
     btnChange.Size             = new System.Drawing.Size(192, 32);
     btnChange.TabIndex         = 6;
     btnChange.Text             = "Change all Beemers to Colts";
     btnChange.Click           += new System.EventHandler(this.btnChange_Click);
     btnMakeDataTable.Location  = new System.Drawing.Point(8, 16);
     btnMakeDataTable.Size      = new System.Drawing.Size(112, 32);
     btnMakeDataTable.TabIndex  = 0;
     btnMakeDataTable.Text      = "Make DataTable";
     btnMakeDataTable.Click    += new System.EventHandler(this.btnMakeDataTable_Click);
     this.Text = "Car Data Table";
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.FormBorderStyle   = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.ClientSize        = new System.Drawing.Size(466, 439);
     this.Controls.Add(this.ColtsViewGrid);
     this.Controls.Add(this.RedCarViewGrid);
     this.Controls.Add(this.btnChange);
     this.Controls.Add(this.txtRemove);
     this.Controls.Add(this.btnRemoveRow);
     this.Controls.Add(this.txtMake);
     this.Controls.Add(this.btnGetMake);
     this.Controls.Add(this.CarDataGrid);
     this.Controls.Add(this.btnMakeDataTable);
     ColtsViewGrid.EndInit();
     RedCarViewGrid.EndInit();
     CarDataGrid.EndInit();
 }