Click here to Skip to main content
15,886,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a flickering problem while loading crystal report with data from a datagridview. And when flickering the program freezes until loading is complete. How can i resolve this problem?? Thank you for any help.
Here is my code
C#
DataSet4 ds = new DataSet4();
DataTable t = ds.Tables.Add("stock");
t.Columns.Add("Item_Name", Type.GetType("System.String"));
t.Columns.Add("Store", Type.GetType("System.String"));
t.Columns.Add("Total_Stock", Type.GetType("System.String"));
t.Columns.Add("Product_Code", Type.GetType("System.String"));
t.Columns.Add("Which", Type.GetType("System.String"));

DataRow r;

string ItemName = string.Empty;
string sto = string.Empty;
string totostok = string.Empty;
string pcode = string.Empty;
string wich = string.Empty;

for (int i = 0; i < dataGridView1.RowCount; i++)
{
    pcode = dataGridView1.Rows[i].Cells[0].Value.ToString();
    ItemName = dataGridView1.Rows[i].Cells[1].Value.ToString();
    sto = dataGridView1.Rows[i].Cells[2].Value.ToString();
    totostok = dataGridView1.Rows[i].Cells[3].Value.ToString();
    wich = cmbFilter.Text;

    r = t.NewRow();
    r["Product_Code"] = pcode;
    r["Item_Name"] = ItemName;
    r["Store"] = sto;
    r["Total_Stock"] = totostok;
    r["Which"] = wich;
    t.Rows.Add(r);

    CrystalReport4 objRpt = new CrystalReport4();
    objRpt.SetDataSource(ds.Tables[1]);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Dock = DockStyle.Fill;
    crystalReportViewer1.Refresh();
    crystalReportViewer1.Show();
}
Posted
Updated 3-Jan-13 20:43pm
v2

I suggest you add the following meta tags:

C#
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0)">
 
Share this answer
 
Comments
Xonel 4-Jan-13 2:11am    
Thank you for the response mailganesh2004, but my application is a windows(Desktop) application not a web app
Orcun Iyigun 4-Jan-13 2:18am    
Then why didnt you tag it!? Leaving people wondering if you are working on ASP.Net, WPF, WinForms...
override create-param property of form,
C#
/// <summary>
/// This method written for avoid flikering while loading timetable
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
protected override CreateParams CreateParams {
    get {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = cp.ExStyle | 0x2000000;
        return cp;
    }
}
//CreateParams

Happy Coding!
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900