Click here to Skip to main content
15,923,164 members
Home / Discussions / C#
   

C#

 
GeneralRe: Versioning Pin
29-May-02 9:55
suss29-May-02 9:55 
GeneralCalling default mail client...... Pin
Pranoti27-May-02 7:35
Pranoti27-May-02 7:35 
GeneralRe: Calling default mail client...... Pin
Rocky Moore27-May-02 8:46
Rocky Moore27-May-02 8:46 
GeneralUsing OCX controls in .NET Pin
JerzyPeter27-May-02 5:50
JerzyPeter27-May-02 5:50 
GeneralTextBox text color Pin
Paddy26-May-02 19:30
Paddy26-May-02 19:30 
GeneralRe: TextBox text color Pin
Nick Parker26-May-02 19:33
protectorNick Parker26-May-02 19:33 
GeneralRe: TextBox text color Pin
Paddy26-May-02 19:47
Paddy26-May-02 19:47 
GeneralRe: TextBox text color Pin
Nick Parker26-May-02 20:00
protectorNick Parker26-May-02 20:00 
Try pasting this code in exactly, I just made this up really quickly.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ChangeColor
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// textBox1
			// 
			this.textBox1.ForeColor = System.Drawing.Color.Aqua;
			this.textBox1.Location = new System.Drawing.Point(72, 80);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(104, 20);
			this.textBox1.TabIndex = 0;
			this.textBox1.Text = "textBox1";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(16, 128);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(104, 24);
			this.button1.TabIndex = 1;
			this.button1.Text = "Change To Red";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(128, 128);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(104, 24);
			this.button2.TabIndex = 2;
			this.button2.Text = "Change To Green";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(256, 221);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.button2,
																		  this.button1,
																		  this.textBox1});
			this.Name = "Form1";
			this.Text = "Change textBox1 Color";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			this.textBox1.ForeColor = Color.Red;
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			this.textBox1.ForeColor = Color.DarkGreen;
		}
	}
}


HTH

Nick Parker
GeneralRe: TextBox text color Pin
Paddy26-May-02 20:44
Paddy26-May-02 20:44 
GeneralRe: TextBox text color Pin
Rocky Moore26-May-02 22:25
Rocky Moore26-May-02 22:25 
GeneralRe: TextBox text color Pin
Paddy27-May-02 1:30
Paddy27-May-02 1:30 
GeneralRe: TextBox text color Pin
Rickard Andersson2027-May-02 1:41
Rickard Andersson2027-May-02 1:41 
GeneralRe: TextBox text color Pin
Paddy27-May-02 2:00
Paddy27-May-02 2:00 
GeneralRe: TextBox text color Pin
Rickard Andersson2027-May-02 2:59
Rickard Andersson2027-May-02 2:59 
GeneralRe: TextBox text color Pin
Paddy27-May-02 3:48
Paddy27-May-02 3:48 
GeneralCycle Through Bytes Of File Pin
Nick Parker26-May-02 17:14
protectorNick Parker26-May-02 17:14 
GeneralRe: Cycle Through Bytes Of File Pin
Nish Nishant26-May-02 19:51
sitebuilderNish Nishant26-May-02 19:51 
GeneralRe: Cycle Through Bytes Of File Pin
Nick Parker26-May-02 20:07
protectorNick Parker26-May-02 20:07 
GeneralRe: Cycle Through Bytes Of File Pin
Nish Nishant26-May-02 20:35
sitebuilderNish Nishant26-May-02 20:35 
GeneralRe: Cycle Through Bytes Of File Pin
Nick Parker27-May-02 4:26
protectorNick Parker27-May-02 4:26 
GeneralRe: Cycle Through Bytes Of File Pin
James T. Johnson27-May-02 5:39
James T. Johnson27-May-02 5:39 
GeneralRe: Cycle Through Bytes Of File Pin
Nish Nishant27-May-02 14:47
sitebuilderNish Nishant27-May-02 14:47 
GeneralRe: Cycle Through Bytes Of File Pin
27-May-02 23:27
suss27-May-02 23:27 
GeneralHelp with peer to peer communication Pin
Brian Olej26-May-02 8:03
Brian Olej26-May-02 8:03 
GeneralRe: Help with peer to peer communication Pin
Rocky Moore26-May-02 22:17
Rocky Moore26-May-02 22:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.