Click here to Skip to main content
16,011,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table in sqlserver database and a particular cell value of a column I want to bind to a richtextbox.
code is:
void fun4explaination(string sql)
       {
           try
           {
               BindingSource ebsource = new BindingSource();
               SqlDataAdapter dae;
               string connectionString = "data source=rakesh-PC;initial catalog=mysoftdb;user id=sa;password=ruhil";
               SqlConnection conne = new SqlConnection(connectionString);
               dae = new SqlDataAdapter(sql, conne);
               conne.Open();
               DataSet dse = new DataSet();
               SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dae);
               dae.Fill(dse, "dictionary");
               ebsource.DataSource = dse.Tables["dictionary"];
               richTextBox4.DataSource = ebsource;                  //problem is here
               richTextBox4.DisplayMember = "explanation";
               richTextBox4.ValueMember = "explanation";
               conne.Close();
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message);
           }
       }

pls help me
Posted
Updated 25-Oct-13 9:02am
v2
Comments
ZurdoDev 25-Oct-13 13:11pm    
Call me crazy but I don't think a textbox has a datasource property. Just set the text property.
joshrduncan2012 25-Oct-13 15:09pm    
I am leaning towards agreeing with you.
Rakesh Ruhil 26-Oct-13 3:05am    
Ok,rich text box does't have these properties so how can we render value of a cell of table
where that cell contains multi lines.
which control can i use?

1 solution

RichTextBox does not have DataSource, DisplayMember or ValueMember. It is a textbox.
 
Share this answer
 
Comments
Rakesh Ruhil 26-Oct-13 3:05am    
Ok,rich text box does't have these properties so how can we render value of a cell of table
where that cell contains multi lines.
which control can i use?
ZurdoDev 26-Oct-13 8:52am    
You can still use it but just set it's Text property.

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