I've thought for ages and maybe its just something simple missing that I cant see. What I want to do is 'do something' when I m coming to the end or at the end of a rtf box when typing (either way not bothered) in a way like below:
private void defineendofrtf(richtextbox rtf)
if ('end of rtf is coming - code I need here')
{
do something;
}
Anyone have any ideas anything to do with rtf.lines

how could I define I m coming to the end of a rtf box?
Milos Velikovsky
If I understand correctly you want to detect when someone is coming close to the end of your richtextbox while typing.
All you need to do is add an eventhandler for the TextChanged event. To do this, go to the properties window with your RTB selected, click on the events button that looks like a lightning bolt, and double click textchanged and add this code. Be sure to set your maxlength to something reasonable to test this. (50,100,150.. etc)
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
MessageBox.Show("max");
or perhaps you can add a label like so to show how many chars you can still type.
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
lblChars.Text = charleft.ToString();
if (charleft == 0)
MessageBox.Show("max");
Sucker in HK
Norbert Mika
int maxlines = rtb.Height / rtb.Font.Height;
if (rtb.Lines.Length == maxlines)
// do something
basically the maximum number of lines that can fit in that space would be the textbox's heigh divided by the line height of its current font. This is very basic though, so you will probably have to use some imagination and a lot of research to figure out what it is that you are trying to accomplish. Maybe if you post your idea here some guru (better than I) will step in and show you how, but you may take more pride and learn more by working through it.
=]
Bradley Grainger