I am currently trying to make my own version of notepad using VB.net 2008 Winforms and I have a problem in making my 'Go To' feature. To explain the situation, I have a 'Go to' sub menu wherein if I type Go to line 8 and hit OK..the blinking cursor should go to line 8 of the multiple line text box. I have implemented a code to know where the current line and column of the cursor but I don't know how to reverse that code so that i can command the blinking cursor to move in that specified line in the multiline textbox..
Code to identify current line and column:
Public Sub linecol()
Try
xid = txtpad.SelectionStart
linenum = txtpad.GetLineFromCharIndex(xid)
xpoint = txtpad.GetPositionFromCharIndex(xid)
xpoint.X = 0
colnum = xid - txtpad.GetCharIndexFromPosition(xpoint)
linenum += 1
colnum += 1
stat.Text = "Ln " & linenum.ToString & ", Col " & colnum.ToString
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
And my problem is how to go to a specify line in that textbox.like going to line 8...