When i click a button , a text box is created in the widows form
and how to change the color of text which is in the text.by the way How to change the font of the text in text box?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Princy GuptaRank #1,602 · 982 reputationPosted Jun 27, 2014, 2:33 AM EDT
hope the below code helps
private void btnGetFullName_Click(object sender, EventArgs e)
{
TextBox textbox_1 = new TextBox();
textbox_1.Text = "New TextBox";
System.Drawing.Font font = new Font("Arial", 8, FontStyle.Bold);
textbox_1.BorderStyle = BorderStyle.FixedSingle;
textbox_1.BackColor = Color.White;
textbox_1.Font = font;
this.Controls.Add(textbox_1);
}
to change the border color you would have to create your own textbox and override OnPaint
Joe WilsonRank #631 · 3.8K reputationPosted Jun 28, 2014, 5:35 AM EDT