FartNocker Posted December 19, 2003 Posted December 19, 2003 Hi, I have all the line numbers from the RichTextBox in an array..... Now, I need to know: 1.) How to programmatically move to a certain line 2.) Select that line 3.) Un-Select that line Hope I'm not being too much of a pain to you guys. There is more to learn about the RTB than there is information out there about it..... I would like to see a site setup just for is using VB.NET By the way, I use VB .NET Fart:-\ Quote
Voca Posted December 19, 2003 Posted December 19, 2003 (edited) I do not think there is some sort of simple possibility selecting lines from multiline-controls :( just by using a linenumber But you could try and get the position of the first and last charakter of your rtb-line. Then there should be some kind of Method called Select(startingindex,endindex) and Unselect. Can't give you any code as I'm not having some VS.net near :( Hope this helps a little Voca _____ Errors are default. Anybody finding one may keep, sell or do whatever he or she may want to do with it ;) Edited December 19, 2003 by Voca Quote
FartNocker Posted December 20, 2003 Author Posted December 20, 2003 Can someone convert this it VB.NET for me? I found it in the FAQ at the top of the fourm. I guess he thought everyone used C# private void GoToLineAndColumn(RichTextBox RTB, int Line, int Column) { int offset = 0; for (int i = 0; i < Line - 1 && i < RTB.Lines.Length; i++) { offset += RTB.Lines[i].Length + 1; } RTB.Focus(); RTB.Select(offset + Column, 0); } Fart:-\ Quote
Moderators Robby Posted December 20, 2003 Moderators Posted December 20, 2003 Private sub GoToLineAndColumn(RTB as RichTextBox , Line as integer, Column as integer) dim offset as integer = 0 dim i as integer = 0 For i = 0 to Line - 1 if i < RTB.Lines.Length then offset += RTB.Lines(i).Length + 1 end if next RTB.Focus() RTB.Select(offset + Column, 0) end sub Quote Visit...Bassic Software
FartNocker Posted December 21, 2003 Author Posted December 21, 2003 Thanks Robby, Got your message... srry Quote
Malfunction Posted December 21, 2003 Posted December 21, 2003 Can someone convert this it VB.NET for me? I found it in the FAQ at the top of the fourm. I guess he thought everyone used C# private void GoToLineAndColumn(RichTextBox RTB, int Line, int Column) { int offset = 0; for (int i = 0; i < Line - 1 && i < RTB.Lines.Length; i++) { offset += RTB.Lines[i].Length + 1; } RTB.Focus(); RTB.Select(offset + Column, 0); } Fart:-\ try this translator next time too bad I always need it vice versa :D Quote Debug me...
FartNocker Posted December 22, 2003 Author Posted December 22, 2003 That's cool Malfunction, Thanks for the link Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.