Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. controls in richtextbox

controls in richtextbox

Scheduled Pinned Locked Moved C#
helpdatabase
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    asdf23211
    wrote on last edited by
    #1

    Hi, I have got a serious problem. I have connect a table with the windows form. The table looks like Id name age place country 1 sss 11 ttt qqq 2 ww 12 eee qqq Now I'm able to display all of them in a richtextbox in the following format whose country = qqq 1. Id ="1" Name = "sss" age =11 place = "ttt" country = "qqq" 2. Id ="2" Name = "ww" age =12 place = "eee" country = "qqq" now i add a linklabel control to the textbox. the text of the linklabel wiill be the result of Name column when on click it is linked to a webpage. here my problem is it is not scrolling along with text. this is how my code looks : public void button3_Click(object sender, EventArgs e) { OdbcCommand bcC2 = new OdbcCommand(); bcC2.CommandText = "select * from C_RefCitation where c_id like ('" + textBox5.Text + "')"; bcC2.Connection = OdbcCon; DataSet q3 = new DataSet(); OdbcDataAdapter db1A2 = new OdbcDataAdapter(bcC2); db1A2.Fill(q3); dataGridView1.DataSource = q3.Tables[0]; richTextBox2.Visible = true; richTextBox2.Clear(); for (int x = 0; x < dataGridView1.Rows.Count - 1; x++) { richTextBox2.AppendText((x + 1).ToString() + ". "); for (int y = 0; y < dataGridView1.Columns.Count; y++) { richTextBox2.AppendText("\n"); richTextBox2.AppendText(dataGridView1.Columns[y].HeaderText); richTextBox2.AppendText(" : "); if (dataGridView1.Columns[y].HeaderText.ToString() == "c_CitationDOI") { this.richTextBox2.SelectionStart = this.richTextBox2.TextLength; int index = richTextBox2.Text.Length; Point position = richTextBox2.GetPositionFromCharIndex(index); LinkLabel label = new System.Windows.Forms.LinkLabel(); RichTextBox sri = new System.Windows.Forms.RichTextBox(); label.Text = dataGridView1.Rows[x].Cells[y].Value.ToString(); label.AutoSize = true; label.Location = new Point(0,position.Y); label.LinkBehavior = LinkBehavior.NeverUnderline; richTextBox2.Controls.Add(label); richTextBox2.AppendText(label.Text); label.Links.Add(1, 7, dataGridView1.Rows[x].Cells[y].Value.ToString()); label.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.label_LinkClicked); } else { richTextBox2.AppendText(dataGridView1.Rows[x].Cells[y].Value.ToString()); } if (y != dataGridView1.Columns.Count - 1) { richTextBox2.AppendText(", "); } } richTextBox2.AppendText("\n\n\n "); } } please help me in modifying this code so that the controls scroll along with text box. Thank you very much

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups