So you've downloaded WinForms Edition, installed and entered your license key, and you're ready to tackle some code. Let’s say you want to start using C1Reports…
You create your new project:
You add a reference to C1.C1Report.4, and you declare your first new report:
Sweet! Let’s give it to run to make sure nothing is wrong so far…
At this point, you may be ready to pull the hair out of your head. One line of code, and there is already a problem. But don’t worry: there's an easy fix.
All ComponentOne Studio WinForms controls, VisualStudio, and the assembly on your machine all work together through a file called licenses.licx. If you're new to using third party controls, you may have never seen this file in your life.
If you're working on a pre-existing project, it may be hiding in your Solution Explorer underneath the Project Name-> Properties-> licenses.licx. On a new project like this, it won’t exist at all yet, but nothing you can’t handle. Simply add it yourself!
Right click on your project -> Add -> New Item will bring up the screen below. Create a new text file and name it licenses.licx (make sure there isn’t a txt extension).
This text file will be added to your project. Don’t worry if it’s not added underneath the Properties. It is fine where it is.
Open up the blank licenses file. This is where the magic happens. But first, a little background…
If you were to drag one of our Winforms components out of your Visual Studio toolbox, for instance the FlexGrid, and drop it onto the Form, the licenses.licx file would get created automatically, and populate it with a line that looks something like this:
C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.4, Version=4.6.20123.730, Culture=neutral, PublicKeyToken=79882d576c6336da
Each of these 5 fields get added to the file, but the two we are interested in are:
What these two fields are will follow the same pattern no matter which control you are using.
Namespace.Class, dll name
In the case of the Flexgrid, the Namespace is C1.Win.C1FlexGrid, the class in the FlexGrid you are using is C1FlexGrid, and the DLL where all of this is coming from is C1.Win.C1FlexGrid.4.
Now back to the licenses.licx file that you just created.
Since you didn’t “drag and drop” anything from the toolbox, and just wrote some code, VisualStudio is unaware that you are using a 3rd party control within your project. Therefore, we need to take matters into our own hands.
We will use the same pattern above, and populate this list ourselves.
In the case of the Report you just added, the namespace is C1.C1Report, the class you are using is C1Report, and the DLL that you added at the very beginning was C1.C1Report.4. Using our pattern above, you can enter the following line into the licenses file:
And that’s it! Now rerun your project, and make sure there is no nag screen:
Just for another test, let’s declare a PrintDocument.
There was no need to add another DLL, because the C1Preview namespace is included within the C1.C1Report.4 dll.
However, if you run this (you guessed it), you will run into another nag screen for C1Report.
But with your new found knowledge, you know just what to do. To the licenses.licx file!
Make your new addition. Now your file will have 2 lines in it:
Give it a rerun and bask in the glory that you have no nag screens.
This method will work for ANY licensing issue. If you have a nag screen (and know you are licensed), this is the first place you should look for answers.
Update: we made an automated tool for fixing .licx file problems. You can read about it and download it here: Generate Your licenses.licx File with the LicxGenerator