Add Link to a line in Code vb.net - vb.net

we have a bit of code with "To Do" comments. Was wondering if there is a way to create a document either in VS or Word where I can describe what is planned and then create a hyperlink of some sort to the VB code?

Visual Studio has this already integrated. Go to the menu View and select there the item Task List (might be under a subnode Other Windows).
The Task List will be now shown. Make sure you select "Comments" in the drop down, to see all TODO's from the comments.

You could use file:// URIs in comments. VS will (by default) make URIs in code clickable unless you turn it off (Tools > Options > Text Editor > $language > Enable single-click URL navigation).

Related

Edit document properties in MS-Word 2016

I am currently trying to setup a template where the user is prompted to add "tags" to their document when they open a new MS-Word file. Currently I have broken this down in a few parts.
Startup prompt
Connect the document/script to the "tag" property (so the user don't have to manually change it)
Ideally implement a drop-down menu, so I don't accidentally tag some files with small differences such as spaces, case sensitive formating etc.
Currently I have tried most of what Word has to offer, which is why I came here. The easiest answer is to go in "File -> Information -> Tags" and edit this manually, but this is what I hope to automate. I have used the feature "Quick Parts", where I can add a field which edits properties such as "Author", "Tags" etc. The problem here is that they are not customizable, so I can not implement a drop-down menu. I have tried to use the "Developer" section in Word to add controllers such as drop-down menus, but I have not found a way to connect these to the document properties. I also tried using the FILLIN command to see if it could be used as shown below, just to test if I could set these properties from the document in this way.
{ SET bkmTitle { TITLE { FILLIN "Enter the document title" } } }
The problem with this implementation is that I don't want to press F9 in these fields when I start up a new project. I have not done much research into the startup prompt because I see this as the finishing touch, but if anyone has any advice on that too, it would be greatly appreciated.
I don't have any experience with macros/VBA, but I am open to learn if that is the easiest way to realize this project. Thank you kindly in advance.
From Charles Kenyon's links I solved my problem with Quick Parts. My solution was to extract the .docx file so I could access the .xml file within. Inside the .docx file (also works with the .dotm template file found in /AppData/Roaming/Microsoft/Templates). Using 7-zip I opened the .dotm archive and went on word -> document.xml.
I made a template by editing the Normal.dotm (MS-Word template file). Here I added a Quick Part for "Category", then saved the template. I then opened the .xml file as mentioned above where I could edit this Quick Part for the template from textfield to a drop down menu (was not possible to change in Word to my knowledge).
To change it into other types than drop down menu, it is possible to add other control forms from Word by clicking on the "Developer" tab and selecting other controls such as "Checkbox". When you open the "document.xml" file afterwards, you can now see the schema for a checkbox.
When editing the "Document Properties" style Quick Parts, they are automatically linked to the document properties, which is what I wanted to learn how to do. It is probably possible to also use the document.xml file to explore how to link other fields to the document properties. I hope this answer might help others if they want to explore more options in MS-Word.

How to list all suggested quick actions

Is there a way to list all the suggested Quick Actions for an open project in VS2017 (v15.3.3)?
I do not see any listed in the Error List window (even with "Build + IntelliSense" selected), though I do see other types of IntelliSense warnings such as CS warnings (e.g. CS1591).
(Quick Actions being the items that are marked in the gutter with a light bulb and accessed with either Alt +Enter or Ctrl+.)
Thanks to a response from the #VisualStudio twitter account, I've come across this MS Docs page that answers this question: https://learn.microsoft.com/en-us/visualstudio/ide/code-styles-and-quick-actions?utm_source=t.co&utm_medium=referral
It describes how to set code style preferences by opening the Tools > Options window and selecting Text Editor > C# / Basic > Code Style > General.
Here there are a list of the code style preferences. To see where they are suggested in one's own code the severity of each can be changed, say from "None" to "Suggestion" or "Warning". Then, during a build, the locations for the related style will be listed in the Build Output or Errors windows
This isn't exactly the same as what you're looking for, but could help you make changes much more quickly to the entire document, project, or solution:
When you try to apply a quick action (using Ctrl + .), you'll get a preview of the changes it will make. At the bottom of that preview is a button that says
"Apply to all occurrences in ..."
This will save you from having to go to every single occurrence in a certain scope and fixing it, which is what I've done for a couple of hours now :(

VS Code Intellisense don't suggest snippet at first

I want to use code snippets in VSCode. But when I type, for example, for in javascript file, the Intellisense doesn't suggest snippet "for-loop" - I need to manually scroll the dropdown and select it. Is there any way to make VSCode to suggest snippets at first? Thank you!
UPD: I have found the person with same problem, but he has no answers - link
You need to use editor.snippetSuggestions config option with "top" value. Please, see Customizing IntelliSense article for more tips and tricks.
There is one more way to deal with this issue by setting
"editor.tabCompletion": true,
that way whenever there is a snnipet available it will use it automatically without even opening the list by using tab twice.
File > Preferences > Settings (Code > Preferences > Settings on Mac)
open "Editor" menu on the left
edit "editor.tabCompletion": true
more info: https://code.visualstudio.com/docs/editor/intellisense#_customizing-intellisense
Now that VS Code mostly abstracted away the settings.json file, you can do the instructions shown by Kavu, with this bonus tip:
go to Preferences > Settings
find the Search settings text input, at the top
type in "snippet"
The setting should be at the top of the result set:
Setting editor.snippetSuggestions to top only works for certain snippets: for but not foreach. With top, the snippet does appear higher in the completion list, but for some reason the keyword version is what is highlighted, with the snippet option scrolled out of view (and the scrollbar quickly fades, giving the impression there's nothing hidden)
The editor.tabCompletion to true approach works for both for and foreach.

Visual Studio 2013 VB intellisense

Apologies upfront if this is a silly question, but it's annoying me to no end and I can't figure it out.
I'm using Visual Studio 2013 Professional, and I usually code in C# where when using the Intellisense, when I press Enter to select a method or something it adds my selection and I can continue typing on the same line.
But at the moment I'm working on a project which is in VB.NET, and when I use the Intellisense in the same way it puts my cursor in the next line, i.e. I press Enter to select whatever, it adds my selection and starts a new line, so I have to press the Backspace to go back to the previous line. It's so annoying!
Is there a way to change this behaviour so the cursor doesn't go to the next line? I've looked at the settings available in Tools > Options but can't figure it out, and searching Google for anything similar hasn't been successful.
Found it here (paragraph List Members)
You have toggled to suggestion mode instead of completion mode.
You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode.
So, either use TAB/SPACEBAR (as I said in the comment) or press CTRL+ALT+SPACEBAR to switch back to completion mode.
EDIT: I've found out that whenever you type Stri (String will show highlighted in the list now) and you press . (dot) it will autocomplete and stay at the same line.
I think your way of doing this in C# isn't possible in Visual Basic.
I had the same problem and discovered that Auto list members was not enabled on my machine. It's under Tools > Options > Text Editor > Basic > General. This gave me the intellisense I was looking for.
Simple thing which can be used when you face this kind of issue is to press
tab key instead of Enter key when the IntelliSense provided me prediction list.

Use the same file in more than one solution

Just wondering whether it is possible to used a single form into more than 1 solutions?
I have frmbookstock.vb in solution A and i need to use frmbookstock.vb in solution B as well. So every time i change the content of the frmbookstock.vb, both of the solution will received the update as well.
I have tried to import it to another solutions, but it will create a new file under the new solution.
Yes you can.
In Visual Studio go to the folder that you want to add the existing item to.
Right click and Go to "Add".
Select "Existing Item".
Select your file.
IMPORTANT STEP: Select the little dropdown arrow next to the "Add" button.
Select "Add as Link" instead.
This will place a link to the original file in the source folder.
So now you have two Visual Studio items in different projects that point to the same, real, file on your hard drive.