473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Code Bookmark

Where is this in VB.net?
Its in VB6, where you can jump from one bookmark to another, to help
navigate your code.
Nov 21 '05 #1
8 1724
in the text editor panel... or in edit -> bookmarks.
--
Salute by the First Time!
"Diarmuid" wrote:
Where is this in VB.net?
Its in VB6, where you can jump from one bookmark to another, to help
navigate your code.

Nov 21 '05 #2
Diarmuid,

Do you see those blue flags in top of your IDE?

Cor
Nov 21 '05 #3
Ok, thanks.
Now that I know where they are, I added them to my toolbar by going
View/Toolbars/Text Editor

"Rothariger" <Ro********@msn.com> wrote in message
news:02**********************************@microsof t.com...
in the text editor panel... or in edit -> bookmarks.
--
Salute by the First Time!
"Diarmuid" wrote:
Where is this in VB.net?
Its in VB6, where you can jump from one bookmark to another, to help
navigate your code.

Nov 21 '05 #4
I set keyboard shortcuts to mine. Ctrl-Alt-B toggles the bookmark on
and off and Ctrl-B and Ctrl-Shift-B jumps to the next/previous
bookmarks.

I also wrote a macro that allows me to jump to the definition of a
method or variable and at the same time, leave a bookmark. That way I
can jump to a definition and hit a hot key and jump right back where I
was.

Nov 21 '05 #5
Hey, thats cool. Didn't even know you could write macros like that.
Any chance you'd sent it me? Its diarmuidq at yahoo dot com
"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
I set keyboard shortcuts to mine. Ctrl-Alt-B toggles the bookmark on
and off and Ctrl-B and Ctrl-Shift-B jumps to the next/previous
bookmarks.

I also wrote a macro that allows me to jump to the definition of a
method or variable and at the same time, leave a bookmark. That way I
can jump to a definition and hit a hot key and jump right back where I
was.

Nov 21 '05 #6
Hey, thats cool. Didn't even know you could write macros like that.
Any chance you'd sent it me? Its diarmuidq at yahoo dot com
"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
I set keyboard shortcuts to mine. Ctrl-Alt-B toggles the bookmark on
and off and Ctrl-B and Ctrl-Shift-B jumps to the next/previous
bookmarks.

I also wrote a macro that allows me to jump to the definition of a
method or variable and at the same time, leave a bookmark. That way I
can jump to a definition and hit a hot key and jump right back where I
was.

Nov 21 '05 #7
Here is the code. The code is pretty simple and there minimal error
checking.
It was cobbled together quickly so it could probably be improved, but
it seems to work. It will only work if called while in a text
document.

I have a hotkey assigned to execute the GotoDefinition sub. That sub
in turn pushes a marker onto a stack (which is a class defined below).
It then executes the IDE's Edit.GoToDefinition command.

Then another hotkey executes the PopMarker sub which retrieves the
bookmark from the stack and jumps to it.

Sub GotoDefinition()
PushMarker()
DTE.ExecuteCommand("Edit.GoToDefinition")
End Sub

Sub PushMarker()

Dim txtDoc As TextDocument =
CType(DTE.ActiveDocument.Object("TextDocument"), TextDocument)

Dim edPt As EditPoint = txtDoc.StartPoint.CreateEditPoint

Dim sel As TextSelection = CType(DTE.ActiveWindow.Selection,
TextSelection)

edPt.MoveToLineAndOffset(sel.CurrentLine, sel.CurrentColumn)
edPt.SetBookmark()

MarkerStack.Push(New Marker(edPt, sel.CurrentLine,
sel.CurrentColumn))

End Sub

Public Sub PopMarker()
Try

Dim m As Marker = MarkerStack.Pop
If Not m Is Nothing Then
Dim txtDoc As TextDocument =
CType(DTE.ActiveDocument.Object("TextDocument"), TextDocument)
Dim objSel As TextSelection =
CType(DTE.ActiveDocument.Selection, TextSelection)
Dim edPt As EditPoint = m.ep

If edPt.TryToShow(vsPaneShowHow.vsPaneShowCentered) Then
edPt.ClearBookmark()
objSel.MoveToLineAndOffset(m.line, m.col)
End If
End If
Catch ex As Exception
Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub

End Module

Public Class MarkerStack
Private Shared MarkerS As New Stack

Shared Sub Push(ByVal m As Marker)
MarkerS.Push(m)
End Sub

Shared Function Pop() As Marker
If MarkerS.Count > 0 Then
Return DirectCast(MarkerS.Pop, Marker)
Else
Return Nothing
End If
End Function

Shared Sub ClearStack()
MarkerS.Clear()
End Sub
End Class

Public Class Marker
Public Sub New(ByVal e As EditPoint, ByVal l As Integer, ByVal c As
Integer)
ep = e
line = l
col = c
End Sub

Public ep As EditPoint
Public line As Integer
Public col As Integer
End Class

Nov 21 '05 #8
Here is the code. The code is pretty simple and there minimal error
checking.
It was cobbled together quickly so it could probably be improved, but
it seems to work. It will only work if called while in a text
document.

I have a hotkey assigned to execute the GotoDefinition sub. That sub
in turn pushes a marker onto a stack (which is a class defined below).
It then executes the IDE's Edit.GoToDefinition command.

Then another hotkey executes the PopMarker sub which retrieves the
bookmark from the stack and jumps to it.

Sub GotoDefinition()
PushMarker()
DTE.ExecuteCommand("Edit.GoToDefinition")
End Sub

Sub PushMarker()

Dim txtDoc As TextDocument =
CType(DTE.ActiveDocument.Object("TextDocument"), TextDocument)

Dim edPt As EditPoint = txtDoc.StartPoint.CreateEditPoint

Dim sel As TextSelection = CType(DTE.ActiveWindow.Selection,
TextSelection)

edPt.MoveToLineAndOffset(sel.CurrentLine, sel.CurrentColumn)
edPt.SetBookmark()

MarkerStack.Push(New Marker(edPt, sel.CurrentLine,
sel.CurrentColumn))

End Sub

Public Sub PopMarker()
Try

Dim m As Marker = MarkerStack.Pop
If Not m Is Nothing Then
Dim txtDoc As TextDocument =
CType(DTE.ActiveDocument.Object("TextDocument"), TextDocument)
Dim objSel As TextSelection =
CType(DTE.ActiveDocument.Selection, TextSelection)
Dim edPt As EditPoint = m.ep

If edPt.TryToShow(vsPaneShowHow.vsPaneShowCentered) Then
edPt.ClearBookmark()
objSel.MoveToLineAndOffset(m.line, m.col)
End If
End If
Catch ex As Exception
Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub

End Module

Public Class MarkerStack
Private Shared MarkerS As New Stack

Shared Sub Push(ByVal m As Marker)
MarkerS.Push(m)
End Sub

Shared Function Pop() As Marker
If MarkerS.Count > 0 Then
Return DirectCast(MarkerS.Pop, Marker)
Else
Return Nothing
End If
End Function

Shared Sub ClearStack()
MarkerS.Clear()
End Sub
End Class

Public Class Marker
Public Sub New(ByVal e As EditPoint, ByVal l As Integer, ByVal c As
Integer)
ep = e
line = l
col = c
End Sub

Public ep As EditPoint
Public line As Integer
Public col As Integer
End Class

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bookmark | last post by:
I have a form that does a few things, such as collect data and than using cdonts emails this data to a place to be parsed. I need to add a bookmark command to this form. I have a javascript...
4
by: Grant | last post by:
Can I add/code a button on my form that will print only the selected record? Thanks Grant Dayton
7
by: ShyGuy | last post by:
I have a form with a combo box for last name. It shows the record with whatever name I select in the combo box. I am trying to get the same results with code when I open the form by using a value...
2
by: corepaul | last post by:
I am fairly new to Access and I have a problem trying to use bookmarks with a recordset. I have a recordset dimensioned as, Dim rstFoodDesc As ADODB.Recordset ' recordset Dim bMark As...
6
by: Chris | last post by:
I have been learning C and want to write a program and need someone to point me in the write direction. I want to write a program to store all my webpage bookmarks in possibly one file. I want it...
5
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be...
0
by: hayworth | last post by:
The new bookmark window is pretty nice. It shows you bookmarks, the filename where they are, and the line number of that file. You can even give custom names to the bookmarks, like "MainLoad" ...
1
by: John Bailo | last post by:
What is a SQL server bookmark (SQL2000/w2k standard)? How does it affect performance? -- Texeme Construct
11
by: Tom Clavel | last post by:
I need to make sure that I am on a different record than I just was on, in a DAO recordset. code fragment: 1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID 2. ...
16
by: google | last post by:
In a continuous form the following code is under a button in the form header. In Access 2003 and earlier, this goes to a new record, then adds relevant data to that new record. DoCmd.GoToRecord...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.