private TextBox txtBoxDragPoint = new TextBox();
private void rtbLogicCode_MouseDown(object sender, MouseEventArgs e)
{
if (dragInfo.Item2 == true)
{
//MessageBox.Show("Works");
Point p = new Point(e.X, e.Y);
txtBoxDragPoint.Name = dragInfo.Item1;
txtBoxDragPoint.Text = dragInfo.Item1;
txtBoxDragPoint.Location = p;
txtBoxDragPoint.Size = new Size(100, 21);
txtBoxDragPoint.Show();
}
}
I have a textbox that is supposed to show when the user clicks on the RichTextBox. The event and the boolean condition is fine as it is displaying the messagebox however, it is not showing the textbox itself. Is there something else I have to do?
Edit: As mentioned in the replies, I have made the following addendum but the textbox still is not showing:
txtBoxDragPoint.Name = dragInfo.Item1;
txtBoxDragPoint.Text = dragInfo.Item1;
txtBoxDragPoint.Location = p;
txtBoxDragPoint.Size = new Size(100, 21);
this.Controls.Add(txtBoxDragPoint);
txtBoxDragPoint.Show();
I don’t know if this information is any relevant but the RTB is added as a control of the tabcontrol, which tabcontrol is added as a control of the form.
You have to add the text box to the form