Thursday, May 4, 2017

Use Visual Basic functions in a LINQPad query

Occasionally, you want to include a Visual Basic (or C#) function such as IIF or Chr() in a LINQ query using LINQPad.  There is two steps to this:


  1. In the Query menu, choose Query Properties.
  2. In the Additional References tab, choose Add, and type Microsoft.VisualBasic.
  3. Then in the Additional Namespace Imports tab, choose the Pick from assemblies link.  Choose the Microsoft.VisualBasic.dll assembly, select the Microsoft.VisualBasic namespace, and then click Add Selected Namespace.

Tuesday, April 11, 2017

Force a site to NOT render in compatibility view

In IE, compatibility view is great.  It forces the newer versions of IE to render a site like it did back when IE 7 was around.  However, sometimes you have an older site that needs compatibility running on the same domain as a newer site that doesn't need compatibility.  You can force the newer site to NOT run in compatibility view by inserting this in the head tag of your page:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
UPDATE: Make sure this line is the first line under the head tag.

Thursday, January 5, 2017

View folders first in File Explorer

I often view my files in descending Modified Date order so that the most recent files are at the top.  However, by default the folders appear last when I do this.  The solution is to first sort by Modified Date, and then Shift and click the Name column.

Wednesday, September 28, 2016

Guide to creating a "fillable" PDF

This post describes a process that I have used to create a form as a "fillable" PDF.

You must have a professional version of the Adobe Acrobat software.  I'm currently using Adobe Acrobat X Pro.  You'll also need a more recent version of Microsoft Word.  I'm using 2010.

First create the form as a word document and design it exactly how you want it to look.  For example:


Then on the File tab, select Save As Adobe PDF.  After it saves, it should open up in Acrobat.  If it opens in Reader, you need to close it and reopen it in Acrobat.

In Acrobat, click Tools, then Forms, then Create:


Choose the current document as the source.  Acrobat will examine the document and look for anything that appears to be a placeholder for a form field.  It then adds a PDF form field to that spot.  If there are any places that it didn't find, you will have to add them manually.  There is a lesson here.  When creating the form initially in Word, become familiar with what Acrobat is looking for, so there is less you have to do manually.


After the form is created, click the Close Form Editing option, and save.  At this point, you have a fillable PDF.  To Add a form field manually, choose Edit in the Forms menu, and then choose Add New Field.  You'll be given a choice of what type of field.  After placing and sizing the field, right click on the field and choose Properties to change the appearance.

Tips

  • To create a group of radio buttons (i.e. Yes/No, etc.) , create the radio button fields individually and name them the same thing, but give them different choice property values.
  • If you create a checkbox in the Word document, Acrobat will automatically set up the radio buttons for you.  However, if you put them in separate table cells, Acrobat won't group them together correctly.
  • To lock down the document, click Protection, More Protection, and Security Properties.  Choose Password Security as the Security Method.  Check the box that says "Restrict editing and printing of the document...".  Then provide a password.  This password can be provided if you wish to edit the document.  Check the "Enable copying of text...." checkbox, and set Printing Allowed to "High Resolution" and Changes Allowed to "Filling in form fields..."


Tuesday, July 26, 2016

Monday, June 13, 2016

Format a MS Word field for currency

Let's say you have a mail merge field in Word.  The data source that populates the field is simply a decimal value.  However, you want it to display with commas.  Use the following formatting switch to accomplish this:

\# "#,##0.00"

This is the original field.

Then, right click and select Toggle Field Codes.




Then, add the switch.





Wednesday, March 30, 2016

Web Services cannot find dll's in nested bin folders

When you create a new project and use a Class Library project type, the default configuration is to put the dll's in a folder named bin/release or bin/debug depending on your current build.  Then if you add a web service (either asmx or wcf), the web service will not be able to find the dll's because they are nested.  You must change the Project Properties, Compile tab, Build Output Path to just "/bin".

If you fail to do this, when you right click on the web service, and click View in Browser, you will get a parser error saying:  Could not create type.

This is a rare problem, because most of the time, you are creating a web project type that makes this configuration for you.