You must Sign In to post a response.
  • Category: .NET

    How to display rich text in gridview of windows form

    I have stored rich text data which contains Text and image both in SQL database in .rtf format,

    Now i want to retrieve that .Rtf data in GridView in my Windows apps...


    So anyone can tell me how to retrieve that data in GridView.....


    thanx in advance..
  • #689996
    you can try this its working for me

    DataTable dt;
    RichTextBox rtx=new RichTextBox();
    SqlConnection con = new SqlConnection("SqlConnection");
    SqlCommand cmd = new SqlCommand("select * from tbl_sample",con);
    SqlDataAdapter ada = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    ada.Fill(ds);
    dt = ds.Tables[0];
    int i=0;
    foreach (DataRow dr in dt.Rows)
    {
    dataGridView1.Rows.Add();
    rtx.Rtf = dr[2].ToString();
    dataGridView1.Rows[i].Cells[0].Value = rtx.Text.ToString();
    i++;
    }

    thanks


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.