Click here to Skip to main content
15,882,055 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I would like to programmatically insert long and string into a box and then mark the selected line in it with the mouse. But I don't know what to choose at all, so I just put it in the RichTextBox. After the line is marked, I would click the ok button and continue working with string and long.The problem is that it is not possible to mark a line in the RichTextBox.

What I have tried:

This is how I have it for now:
C#
private Form Okno(Dictionary<long, string> listAnotaci)
       {
           Form form = new Form();
           Button button1 = new Button();
           Size velikostTlacitka = new Size(90, 30);
           button1.Size = velikostTlacitka;
           button1.DialogResult = DialogResult.OK;
           button1.Text = "OK";
           System.Drawing.Point point1 = new System.Drawing.Point(155, 130);
           button1.Location = point1;
           form.Controls.Add(button1);
           var result = String.Join(".", listAnotaci.ToArray());
           result = result.Replace(".", System.Environment.NewLine);
          RichTextBox textBox = new RichTextBox();
          textBox.ReadOnly = true;
          textBox.Text = result;
           Size velikostForm = new Size(400, 200);
           Size velikostTextBox = new Size(400, 130);
           textBox.Size = velikostTextBox;
           form.Size = velikostForm;
           form.Text = "Bylo zvoleno více anotací";
           form.Controls.Add(textBox);
           return form;
       }


I would appreciate any advice and tips.

Thank you David
Posted
Updated 12-Aug-22 1:39am
v2
Comments
OriginalGriff 12-Aug-22 7:16am    
And?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.
dejf111 12-Aug-22 7:28am    
Better?

1 solution

 
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