Click here to Skip to main content
15,881,687 members
Home / Discussions / C#
   

C#

 
QuestionRe: need code for the below explained requirement. Pin
cuser_id17-Aug-06 19:49
cuser_id17-Aug-06 19:49 
QuestionHow do you figure out the best contrasting-opposite color Pin
FocusedWolf17-Aug-06 18:10
FocusedWolf17-Aug-06 18:10 
AnswerRe: How do you figure out the best contrasting-opposite color Pin
sarojkumarjena17-Aug-06 18:32
sarojkumarjena17-Aug-06 18:32 
GeneralRe: How do you figure out the best contrasting-opposite color Pin
Coding C#17-Aug-06 22:24
Coding C#17-Aug-06 22:24 
GeneralRe: How do you figure out the best contrasting-opposite color Pin
mabo4217-Aug-06 23:00
mabo4217-Aug-06 23:00 
GeneralRe: How do you figure out the best contrasting-opposite color [modified] Pin
FocusedWolf18-Aug-06 6:15
FocusedWolf18-Aug-06 6:15 
Questionbackspace Pin
sarojkumarjena17-Aug-06 18:06
sarojkumarjena17-Aug-06 18:06 
AnswerRe: backspace Pin
Nader Elshehabi17-Aug-06 18:51
Nader Elshehabi17-Aug-06 18:51 
Hello

There are several approaches. This is the one I use:

bool ToChange = true;
string OldText = "";

private void TextBox_KeyDownHandler(object sender, KeyDownArgs e)
{
    If(e.KeyChar == "\b")
    {
        OldText = TextBox.Text;
        ToChange = false;
    }
    else
        ToChange = true;
}

private void TextBox_TextChanged((object sender, KeyDownArgs e)
{
    If(!ToChange)
    {
        TextBox.Text = OldText;
        TextBox.SelectionStart = TextBox.TextLength;
    }
}


You see. The text hasn't changed when the keydown event was fired. So if we don't want to accept thechanges we store the original text in a string. Once the text has changed, the TextChanged event will be fired. It will check to see if we want to accept the changes. If not, revert to the old text.

If anyone got a better approach, please post.Smile | :)

RegardsRose | [Rose]
AnswerRe: backspace Pin
coolestCoder17-Aug-06 19:50
coolestCoder17-Aug-06 19:50 
AnswerRe: backspace Pin
stancrm17-Aug-06 22:06
stancrm17-Aug-06 22:06 
QuestionAutomatically uppercase event handlers Pin
Joe Woodbury17-Aug-06 17:45
professionalJoe Woodbury17-Aug-06 17:45 
AnswerRe: Automatically uppercase event handlers Pin
Christian Graus17-Aug-06 17:50
protectorChristian Graus17-Aug-06 17:50 
GeneralRe: Automatically uppercase event handlers Pin
Joe Woodbury17-Aug-06 17:52
professionalJoe Woodbury17-Aug-06 17:52 
Questionhave anyone use carbon or razor framework? Pin
adong200617-Aug-06 16:33
adong200617-Aug-06 16:33 
QuestionSqlDependency and which rows actually changed? Pin
rpheaney17-Aug-06 14:55
rpheaney17-Aug-06 14:55 
QuestionComparing 2 arrays and retreiving the difference Pin
loneferret17-Aug-06 14:53
loneferret17-Aug-06 14:53 
AnswerRe: Comparing 2 arrays and retreiving the difference Pin
Christian Graus17-Aug-06 14:58
protectorChristian Graus17-Aug-06 14:58 
GeneralRe: Comparing 2 arrays and retreiving the difference [modified] Pin
loneferret17-Aug-06 15:34
loneferret17-Aug-06 15:34 
QuestionAdd flash content in custom control C#.NET file Pin
Dpriya17-Aug-06 12:15
Dpriya17-Aug-06 12:15 
AnswerRe: Add flash content in custom control C#.NET file Pin
Corinna John17-Aug-06 20:27
Corinna John17-Aug-06 20:27 
QuestionStoring Size&Position of WindowForms Pin
Frygreen17-Aug-06 11:00
Frygreen17-Aug-06 11:00 
AnswerRe: Storing Size&Position of WindowForms Pin
Ennis Ray Lynch, Jr.17-Aug-06 12:19
Ennis Ray Lynch, Jr.17-Aug-06 12:19 
QuestionComboBox/CheckBox background color when disabled. [modified] Pin
sykiemikey17-Aug-06 10:54
sykiemikey17-Aug-06 10:54 
AnswerRe: ComboBox/CheckBox background color when disabled. Pin
Nader Elshehabi17-Aug-06 19:02
Nader Elshehabi17-Aug-06 19:02 
GeneralRe: ComboBox/CheckBox background color when disabled. Pin
sykiemikey17-Aug-06 20:58
sykiemikey17-Aug-06 20:58 

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.