Click here to Skip to main content
15,904,415 members
Home / Discussions / C#
   

C#

 
QuestionPrinting a blank page in Active report Pin
Test27030725-May-07 20:41
Test27030725-May-07 20:41 
AnswerRe: Printing a blank page in Active report Pin
Member 1197347511-Jan-17 20:54
Member 1197347511-Jan-17 20:54 
Questionlimited installation Pin
yazeed_pal25-May-07 20:16
yazeed_pal25-May-07 20:16 
QuestionORA-06413: Connection not open. Pin
Muammar©25-May-07 20:00
Muammar©25-May-07 20:00 
AnswerI found the solution:) Pin
Muammar©25-May-07 20:07
Muammar©25-May-07 20:07 
QuestionADO.Net 2.0 Transaction Pin
Agyeman25-May-07 18:04
Agyeman25-May-07 18:04 
Questiondumbed down auto indent/smart indent Pin
simplicitylabs25-May-07 17:34
simplicitylabs25-May-07 17:34 
AnswerRe: dumbed down auto indent/smart indent Pin
Dave Herren25-May-07 18:36
Dave Herren25-May-07 18:36 
Try:
int lineNumber = richTextBox1.GetLineFromCharIndex(pos-1) ;

richTextBox1.Lines[] is a zero index array, but in your example if I press enter on the first line GetLineFromCharIndex returns 1 not 0, so you loop was reading data from the wrong line. According to the documetation GetLineFromCharIndex returns on a zero index as well, so I knew that wasn't the problem. My next thought was that the enter key had been processed, but that didn't make sense because the code is in the keypress event handler.

Here is what I finally figured out... You are getting the selection index which is at the end of the line. This puts it one past the last character. Because of this GetLineFromCharIndex seems to consider it on the next line. So if you do GetLineFromCharIndex(pos-1) which gets the character before that, then everything works out.



topcoderjax - Remember, Google is your friend.

GeneralRe: dumbed down auto indent/smart indent [modified] Pin
simplicitylabs25-May-07 19:15
simplicitylabs25-May-07 19:15 
GeneralRe: dumbed down auto indent/smart indent Pin
Dave Herren26-May-07 2:49
Dave Herren26-May-07 2:49 
GeneralRe: dumbed down auto indent/smart indent Pin
simplicitylabs26-May-07 6:18
simplicitylabs26-May-07 6:18 
GeneralRe: dumbed down auto indent/smart indent Pin
Dave Herren26-May-07 10:03
Dave Herren26-May-07 10:03 
GeneralRe: dumbed down auto indent/smart indent Pin
simplicitylabs26-May-07 12:22
simplicitylabs26-May-07 12:22 
GeneralRe: dumbed down auto indent/smart indent Pin
Dave Herren26-May-07 16:55
Dave Herren26-May-07 16:55 
GeneralRe: dumbed down auto indent/smart indent Pin
simplicitylabs26-May-07 19:38
simplicitylabs26-May-07 19:38 
GeneralRe: dumbed down auto indent/smart indent Pin
Dave Herren27-May-07 2:07
Dave Herren27-May-07 2:07 
Questionhow to actualize Bug Report Pin
jason_mf25-May-07 17:14
jason_mf25-May-07 17:14 
AnswerRe: how to actualize Bug Report Pin
MatrixCoder25-May-07 17:41
MatrixCoder25-May-07 17:41 
QuestionHello Pin
dhulipudi25-May-07 17:03
dhulipudi25-May-07 17:03 
AnswerRe: Hello Pin
Muammar©25-May-07 20:10
Muammar©25-May-07 20:10 
GeneralRe: Hello Pin
Guffa25-May-07 23:11
Guffa25-May-07 23:11 
AnswerRe: Hello Pin
Guffa25-May-07 23:09
Guffa25-May-07 23:09 
GeneralRe: Hello Pin
dhulipudi26-May-07 0:34
dhulipudi26-May-07 0:34 
GeneralRe: Hello Pin
Paul Conrad27-May-07 6:33
professionalPaul Conrad27-May-07 6:33 
Questionsearch and delete Pin
picasso225-May-07 15:05
picasso225-May-07 15:05 

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.