Click here to Skip to main content
15,914,359 members
Home / Discussions / C#
   

C#

 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 5:28
protectorHeath Stewart2-Jan-04 5:28 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 6:11
Mazdak2-Jan-04 6:11 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 6:47
protectorHeath Stewart2-Jan-04 6:47 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 7:23
Mazdak2-Jan-04 7:23 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 9:03
protectorHeath Stewart2-Jan-04 9:03 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 9:52
Mazdak2-Jan-04 9:52 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 10:05
protectorHeath Stewart2-Jan-04 10:05 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 10:26
Mazdak2-Jan-04 10:26 
QuestionRSS in these messageborads??? Pin
Mohsen Sajjadi1-Jan-04 21:24
Mohsen Sajjadi1-Jan-04 21:24 
AnswerRe: RSS in these messageborads??? Pin
Colin Angus Mackay1-Jan-04 22:16
Colin Angus Mackay1-Jan-04 22:16 
AnswerRe: RSS in these messageborads??? Pin
Heath Stewart2-Jan-04 5:19
protectorHeath Stewart2-Jan-04 5:19 
GeneralNot sure? Help! Pin
Member 7957781-Jan-04 17:58
Member 7957781-Jan-04 17:58 
GeneralRe: Not sure? Help! Pin
Colin Angus Mackay1-Jan-04 22:11
Colin Angus Mackay1-Jan-04 22:11 
QuestionC# StreamReader blocks ? Pin
Luther Baker1-Jan-04 11:26
Luther Baker1-Jan-04 11:26 
AnswerRe: C# StreamReader blocks ? Pin
Colin Angus Mackay1-Jan-04 11:53
Colin Angus Mackay1-Jan-04 11:53 
GeneralRe: C# StreamReader blocks ? Pin
Luther Baker1-Jan-04 19:22
Luther Baker1-Jan-04 19:22 
GeneralC# select equivalent Pin
Luther Baker1-Jan-04 11:20
Luther Baker1-Jan-04 11:20 
GeneralRe: C# select equivalent Pin
Heath Stewart2-Jan-04 5:12
protectorHeath Stewart2-Jan-04 5:12 
GeneralRe: C# select equivalent Pin
Luther Baker2-Jan-04 7:58
Luther Baker2-Jan-04 7:58 
GeneralRe: C# select equivalent Pin
Heath Stewart2-Jan-04 9:06
protectorHeath Stewart2-Jan-04 9:06 
GeneralRe: C# select equivalent Pin
Luther Baker2-Jan-04 10:19
Luther Baker2-Jan-04 10:19 
GeneralRe: C# select equivalent Pin
Luther Baker2-Jan-04 11:14
Luther Baker2-Jan-04 11:14 
Ok, that works even faster and now I don't have to manually deal with threading.

As a side note, when using ReadLine, I noticed my problem again. Here's what I did:

Open notepad, type a few lines, DO NOT newline, save the file.

The tail callback works perfectly. The new text is echoed to the TextBox (I manually insert a new line since ReadLine stripped it.)

Type in a few more characters and save again (still, never typing a newline).

The tail callback misses the first two chars!!

So, I opened cygwin - and got the same behavior!!!

As I believe you explained, tail is reading a line at a time. When I don't type a newline and simply save new text into the file - expecting it to be echoed, it doesn't pick up the first two chars (something do to with expectation of \r\n I would guess).

If I DO type a newline and then save, the following text is read correctly from the first char.

So, that means ReadLine works just fine for what I'm doing - which further simplifies this.

Thanks,

-Luther

One last tidbit, I've implemented native calls to scroll the screen with line appended. Unfortunately, its possible these windows won't have focus when they are tailing files - and it seems that the built in TextBox/RichTextBox must have focus and move manually move the caret and then must scroll to the caret. Awfully cumbersome.

I've wrapped the calls in a class, but they are similar to this:

public readonly uint EM_LINESCROLL = 0x00B6;
public readonly uint EM_GETFIRSTVISIBLELINE = 0x00CE;
public readonly uint EM_GETLINECOUNT = 0x00BA;

[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, uint wParam, uint lparam);

private void button1_Click(object sender, System.EventArgs e)
{
int line = SendMessage(richTextBox1.Handle, EM_GETFIRSTVISIBLELINE, 0, 0);
int linecount = SendMessage(richTextBox1.Handle, EM_GETLINECOUNT, 0, 0);
SendMessage(richTextBox1.Handle, EM_LINESCROLL, 0, (uint)(linecount - line - 2));
}


Oddly, TextBox scrolls one line at at time. RichTextBox scrolls a page at a time ... unusable for what I'm doing.


Generalinternet dial Pin
heba_zien1-Jan-04 11:09
heba_zien1-Jan-04 11:09 
GeneralRe: internet dial Pin
Heath Stewart2-Jan-04 4:50
protectorHeath Stewart2-Jan-04 4:50 
GeneralFiltered DataGrid Pin
Heroz1-Jan-04 7:23
Heroz1-Jan-04 7:23 

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.