Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
AnswerRe: Assemblies References Pin
Lars Niedziolka31-Aug-05 14:07
Lars Niedziolka31-Aug-05 14:07 
AnswerRe: Assemblies References Pin
Stefan Troschuetz31-Aug-05 21:24
Stefan Troschuetz31-Aug-05 21:24 
QuestionFrame Capturing From AVI Movie Pin
Nabeel Younus Khan31-Aug-05 10:58
Nabeel Younus Khan31-Aug-05 10:58 
AnswerRe: Frame Capturing From AVI Movie Pin
Lars Niedziolka31-Aug-05 14:10
Lars Niedziolka31-Aug-05 14:10 
Questionrichtextbox @ if_mel_yes_else_no Pin
surfman1931-Aug-05 9:40
surfman1931-Aug-05 9:40 
AnswerRe: richtextbox @ if_mel_yes_else_no Pin
Mohamad Al Husseiny31-Aug-05 10:05
Mohamad Al Husseiny31-Aug-05 10:05 
Answer[Message Deleted] Pin
Dave Kreskowiak31-Aug-05 10:19
mveDave Kreskowiak31-Aug-05 10:19 
AnswerRe: richtextbox @ if_mel_yes_else_no Pin
Dave Kreskowiak31-Aug-05 10:19
mveDave Kreskowiak31-Aug-05 10:19 
The text wasn't cleared when you hit the keys because you're handling the keydown event and resetting the selection length to 0 before your KeyDown code is finished and before the textbox gets the keystroke.

What I'm guessing you have to do (I don't know what your requirements are) is in your KeyDown event handler, save the current SelectionStart and SelectionLength values before you change anything, then restore them back to what they were before after you're done making any changes.
private void textBox_Receivers_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    int saveSelStart = textBox_Receivers.SelectionStart;
    int saveSelLength = textBox_Receivers.SelectionLength;

    textBox_Receivers.SelectionStart = 0;
    textBox_Receivers.SelectionLength = textBox_Receivers.Text.Length;
    textBox_Receivers.SelectionFont = new Font("Arial", 8, FontStyle.Regular);

    textBox_Receivers.SelectionStart = saveSelStart;
    textBox_Receivers.SelectionLength = saveSelLength;
}

I have no idea why you would want to do this anyway. With every keystroke, you're resetting the font for your entire textbox to Arial 8pt. Why would you want to do this? Why not set it once for the entire textbox and be done with it?


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: richtextbox @ if_mel_yes_else_no Pin
surfman1931-Aug-05 12:09
surfman1931-Aug-05 12:09 
GeneralRe: richtextbox @ if_mel_yes_else_no Pin
Dave Kreskowiak31-Aug-05 12:32
mveDave Kreskowiak31-Aug-05 12:32 
Questionproperty lists Pin
BungoMan8531-Aug-05 9:05
BungoMan8531-Aug-05 9:05 
AnswerRe: property lists Pin
Mohamad Al Husseiny31-Aug-05 9:19
Mohamad Al Husseiny31-Aug-05 9:19 
QuestionOpen Graph via: icon Pin
Debs*31-Aug-05 8:35
Debs*31-Aug-05 8:35 
AnswerRe: Open Graph via: icon Pin
Mohamad Al Husseiny31-Aug-05 9:30
Mohamad Al Husseiny31-Aug-05 9:30 
GeneralRe: Open Graph via: icon Pin
Debs*1-Sep-05 6:27
Debs*1-Sep-05 6:27 
QuestionPlay raw data Pin
Niklas Ulvinge31-Aug-05 8:07
Niklas Ulvinge31-Aug-05 8:07 
QuestionReflection Pin
Yoyosch31-Aug-05 7:23
Yoyosch31-Aug-05 7:23 
AnswerRe: Reflection Pin
Andrew Kirillov31-Aug-05 10:13
Andrew Kirillov31-Aug-05 10:13 
GeneralRe: Reflection Pin
Yoyosch31-Aug-05 11:46
Yoyosch31-Aug-05 11:46 
GeneralRe: Reflection Pin
Andy Brummer31-Aug-05 11:57
sitebuilderAndy Brummer31-Aug-05 11:57 
GeneralRe: Reflection Pin
Yoyosch31-Aug-05 12:02
Yoyosch31-Aug-05 12:02 
QuestionRe: Reflection Pin
Yoyosch31-Aug-05 12:38
Yoyosch31-Aug-05 12:38 
AnswerRe: Reflection Pin
Werdna31-Aug-05 13:50
Werdna31-Aug-05 13:50 
GeneralRe: Reflection Pin
Yoyosch31-Aug-05 14:15
Yoyosch31-Aug-05 14:15 
AnswerRe: Reflection Pin
Andy Brummer31-Aug-05 18:01
sitebuilderAndy Brummer31-Aug-05 18:01 

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.