So I am using gridview and want it so my first 2 clumns of my last row to combine into one. Becuase right now just have a blank area and it looks weird.

Also trying to figure out how to set the font a diffrent size on that 1 word also.

dt.Rows.Add(new object[] { "Line Totals",  "", cases, target,
                                                             ((cases / target) * 100).ToString("n2") + "%", changeovers - 1});

Trying to change font of " Line Totals" and merge "Line Totals" with the blank area "".

Edited 3 Years Ago by Kratoswoo

To set the font of a DGV cell, you could use this:
Made a DGV with 3 columns in the designer and then used this code in the form load:

private void Form1_Load(object sender, EventArgs e)
        {
            dataGridView1[0, 0].Value = "C1R1";
            dataGridView1[1, 0].Value = "C2R1";
            dataGridView1[2, 0].Value = "C3R1";

            dataGridView1[1, 0].Style =
                new DataGridViewCellStyle { Font = new Font("Ariel", 15, FontStyle.Italic) };
        }

As for merging try this

Edited 3 Years Ago by ddanbe: addition

I am using DataVew with ASP.net

 dt.Columns.Add(new DataColumn("Scale ", typeof(String)));
        dt.Columns.Add(new DataColumn("Name ", typeof(String)));
        dt.Columns.Add(new DataColumn("Actual Cases ", typeof(String)));
        dt.Columns.Add(new DataColumn("Actual Target ", typeof(String)));
        dt.Columns.Add(new DataColumn("Actual Efficiency ", typeof(String)));
        dt.Columns.Add(new DataColumn("Change Over ", typeof(String)));
        dr = dt.NewRow();
        GridView1.DataSource = dt;

That is setting the columns

Then I have

dt.Rows.Add(new object[] { i , name, s.Cases, s.ActualTarget,
                                                                    ((s.Cases / s.ActualTarget) * 100).ToString("n2") + "%",
                                                                    s.Items, });

And that is getting all the information to fill in each column.

Then I have

 dt.Rows.Add(new object[] { "Line Totals", "", cases, target,
                                                             ((cases / target) * 100).ToString("n2") + "%", changeovers - 1});

And that is getting the totals for everything. And want to make it so "Line Totals" stays under "Scale" and goes into "Name" but keeps the other rows in that column inside thei columns.

Also want to change Size of that "Line Totals".

Edited 3 Years Ago by Kratoswoo

This article has been dead for over six months. Start a new discussion instead.