Click here to Skip to main content
15,918,617 members
Home / Discussions / C#
   

C#

 
AnswerRe: SqlTriggerContext? Pin
zt.Prog20-Jan-07 23:40
zt.Prog20-Jan-07 23:40 
Questionweb service Pin
michael_jhons18-Jan-07 2:16
michael_jhons18-Jan-07 2:16 
AnswerRe: web service Pin
Rick van Woudenberg18-Jan-07 2:33
Rick van Woudenberg18-Jan-07 2:33 
Questionlogin Pin
fmardani18-Jan-07 1:56
fmardani18-Jan-07 1:56 
AnswerRe: login Pin
Dustin Metzgar18-Jan-07 3:23
Dustin Metzgar18-Jan-07 3:23 
Questionhow to change text box.text when textbox are disabled. Pin
sumit_kumar18-Jan-07 1:33
sumit_kumar18-Jan-07 1:33 
AnswerRe: how to change text box.text when textbox are disabled. Pin
Christian Graus18-Jan-07 1:47
protectorChristian Graus18-Jan-07 1:47 
GeneralRe: how to change text box.text when textbox are disabled. Pin
Rick van Woudenberg18-Jan-07 2:24
Rick van Woudenberg18-Jan-07 2:24 
Christian,

Good anwser, but I do have a side note though Smile | :)
The grayed out bit is a standard behaviour on a disabled textbox. This cannot be changed. However, there are some ways around it though.

1. Override the OnPaint event of the textbox.

{
SolidBrush drawBrush = new SolidBrush( ForeColor ); //Use the ForeColor property
// Draw string to screen.
e.Graphics.DrawString( Text, Font, drawBrush, 0f, 0f ); //Use the Font property
}

Note: You need to set the ControlStyles to "UserPaint" in the constructor.

public MyTextBox()
{
// This call is required by the Windows.Forms Form Designer.
SetStyle( ControlStyles.UserPaint, true );
InitializeComponent();
}

or something like that.


2. ( one of my favorites and less complicated ). Set the textbox to readonly and change te colors. This will preserve the textbox properties, allowing you to do anything with it that you want, and still mimic a 'disabled look'

private void OnClickButton(sender object, EventArgs e)
{
myTextbox.ReadOnly = true;
myTextbox.Forecolor = System.Drawing.Color.Red;
myTextbox.Backcolor = System.Drawing.Color.Gray;
}

Cheers,


GeneralRe: how to change text box.text when textbox are disabled. Pin
V.18-Jan-07 3:33
professionalV.18-Jan-07 3:33 
GeneralRe: how to change text box.text when textbox are disabled. Pin
Christian Graus18-Jan-07 9:21
protectorChristian Graus18-Jan-07 9:21 
QuestionTo write file to other system on LAN Pin
RimiAsh18-Jan-07 1:30
RimiAsh18-Jan-07 1:30 
AnswerRe: To write file to other system on LAN Pin
Dustin Metzgar18-Jan-07 3:28
Dustin Metzgar18-Jan-07 3:28 
GeneralRe: To write file to other system on LAN Pin
RimiAsh20-Jan-07 5:46
RimiAsh20-Jan-07 5:46 
GeneralRe: To write file to other system on LAN Pin
Dustin Metzgar20-Jan-07 10:54
Dustin Metzgar20-Jan-07 10:54 
QuestionHow I can add seperator between two buttons on toolbar Pin
amitrajput28418-Jan-07 1:08
amitrajput28418-Jan-07 1:08 
AnswerRe: How I can add seperator between two buttons on toolbar Pin
Rick van Woudenberg18-Jan-07 1:16
Rick van Woudenberg18-Jan-07 1:16 
GeneralRe: How I can add seperator between two buttons on toolbar Pin
amitrajput28418-Jan-07 1:25
amitrajput28418-Jan-07 1:25 
GeneralRe: How I can add seperator between two buttons on toolbar Pin
Abisodun18-Jan-07 1:56
Abisodun18-Jan-07 1:56 
AnswerRe: How I can add seperator between two buttons on toolbar Pin
ShermansLagoon18-Jan-07 1:46
ShermansLagoon18-Jan-07 1:46 
QuestionNo automatic close menus [modified] Pin
nadapublicidad18-Jan-07 0:48
nadapublicidad18-Jan-07 0:48 
AnswerRe: No automatic close menus Pin
Rick van Woudenberg18-Jan-07 0:53
Rick van Woudenberg18-Jan-07 0:53 
QuestionHow to invoke delegates from any C# class Pin
Maddie from Dartford18-Jan-07 0:21
Maddie from Dartford18-Jan-07 0:21 
QuestionHow to identify the changes in TextBox? Pin
Nothend18-Jan-07 0:08
Nothend18-Jan-07 0:08 
AnswerRe: How to identify the changes in TextBox? Pin
ChandruIT18-Jan-07 0:19
ChandruIT18-Jan-07 0:19 
GeneralRe: How to identify the changes in TextBox? Pin
Nothend18-Jan-07 0:44
Nothend18-Jan-07 0:44 

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.