Wednesday, 16 October 2019

DevExpress Winform Controls using Different SKINS - not working

When you want to use a different skin theme for your DevExpress Winform control but it still doesn't change when you run it, try doing these:

1. Go to your project properties and click on the "View Applicaiton Events"
2. Select "MyApplicationEvents" - "Startup" and under your startup procedure add these codes:

            DevExpress.UserSkins.BonusSkins.Register()
            DevExpress.Skins.SkinManager.EnableFormSkins()
            DevExpress.Skins.SkinManager.EnableMdiFormSkins()

Example:

Imports Microsoft.VisualBasic.ApplicationServices

Namespace My
    ' The following events are available for MyApplication:
    ' Startup: Raised when the application starts, before the startup form is created.
    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    ' UnhandledException: Raised if the application encounters an unhandled exception.
    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. 
    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    Partial Friend Class MyApplication
        Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
            DevExpress.UserSkins.BonusSkins.Register()
            DevExpress.Skins.SkinManager.EnableFormSkins()
            DevExpress.Skins.SkinManager.EnableMdiFormSkins()
        End Sub
    End Class

End Namespace

3. Now go to your Windows form designer and add a component called "DefaultLookAndFeel" and then select the skin theme that you want to use. Compile and run your solution and it should work. 


I tried all other solutions suggested from different postings but this one worked for me.

Thursday, 15 August 2019

A Systems Developer should strive like a "Star Jasmine"

According to this site gardenia.net a "Star Jasmine" is an award-winning vigorous, medium-sized, evergreen shrub or vine...

My mum-in-law planted this one on one side of our previous house and it went really well, in fact too much well that I have to keep it trimmed or tamed as it tries to climb in the ceiling of our house via tiny gaps. Amazingly this plant also tries to make paths and widen gaps as I've discovered that it had made a bulging and very tough vines or trunk in between gaps of our steel fence, it had forced it ways in the gaps that it had deformed the look of the steel fence, not much but visibly noticeable.
Just like a "Star Jasmine" nothing should stop you from striving, learning and finding solutions even if you are working on a constrained environment like working in a corporate company where everything is restrained (of course for the sake of security/rules and paranoia - perhaps?). We should be vigorous and always aim to make path - not just a path but a good path, firm but innovative!

Friday, 19 February 2016

Removing unwanted .NET Framework from your Visual C++ Win32 project


If you are using Visual Studio (2010, for some reason) for Visual C++ Win32 project and if you want to remove the .NET Framework dependency (because VS won't let you opt-out from the start when you are creating a new project) all you have to do is to follow these steps.

1. Manually add these lines into your project file.


             <PropertyGroup> 
                 <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
              </PropertyGroup>

    And make sure it is above the line - <ItemGroup Label="ProjectConfigurations">.

    As per this KB article from Microsoft - https://support.microsoft.com/en-us/kb/2735477

2. According to the KB article  "Also, in the setup project, open the Launch Condition editor and remove the “Microsoft .NET” launch condition. " but I can't find the Launch Condition editor, I'm guessing because of my VS 2010 Environment Settings, anyway if you can't see it either then just do this.

Open your project properties screen and go to the C/C++ General settings under the Configuration Properties section and make sure your Common Language RunTime Support field was set to "No Common Language RunTime Support".




















3. Under your "Installer" project properties open up the "Prerequisites" screen and untick any .NET Framework stuff.




4. Now rebuild your "Installer" project (the installer project you've created for your project) and you shouldn't be seeing any more of the .NET Framework stuff under the "Detected Dependencies".




      You shouldn't be seeing anymore of any ".NET" word on your "Installer" project build output logs. Otherwise you may have to remove and delete the installer project and create a new one again.



***NOTE: I am not sure if this is the case for the newer version of VS (hope it will be much more straight forward) I will try this at home with my later version of VS.

Wednesday, 10 February 2016

Enumerating entries from Global Address List for Microsoft Outlook Interop

I used to use this code below to access the Global Address List of all Microsoft Outlook list of email addresses.

          Outlook.AddressList gal = outlookApp.Session.GetGlobalAddressList();

where "outLookApp" is

          Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();

however one day that code doesn't work anymore for some reason and I looked around and have used these codes instead:

          Outlook.AddressLists addrLists = outlookApp.Session.AddressLists;
          Outlook.AddressList gal = addrLists["Global Address List"];

which did the trick!

I'll have to do some checking what's the difference and what have changed. Next time....




Friday, 5 February 2016

Windows Service application unable to send print job

I've been trying to send print job into a remote printer via a Windows Service application in a few different ways: 

  • .Net PrintDocument class
  • a third party library (on-demand printing)
  • ghost script + ghostview
however I was not successful. I found out that Windows Service doesn't allow you or doesn't easily allow you to send or create a print job at all for security reasons or for any reasons. See posts:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502.aspx

http://stackoverflow.com/questions/15834064/printing-from-windows-service-on-windows-8-fails

Well another day past and some lost hairs (due to hair pulling) I found a web post about a utility class that creates a "Raw" print job and I thought it may work because Windows won't treat it as calling or executing another windows app or windows process which the Windows Service doesn't like to do. So I give it a go and it works! See the section of the page where it says "2. Mit VB.Net RAW-Daten an den Drucker senden" which translate to "Send With VB.Net RAW data to the printer". (Note: The website is in german language. Thank you Germany!)

http://www.vbarchiv.net/tipps/tipp_2375-kassenbon-drucker-mit-vbnet-oder-c-per-esc-pos-befehle-ansprechen.html

Tuesday, 11 August 2015

Entity Framework SQL Generated Scripts Speed Gotcha

One day I was working with tables with non-unique primary keys and was able to use the Visual Studio Entity Model EDMX editor to generate the classes for me. I know in my gut-feeling that there could be something wrong with I am doing since when you are using Entity Framework your table should have a unique key identifier. Anyway I ignored this thought and proceeded - everything works well in terms of adding and using the generated classes however I noticed that the query (with a subquery on it) was taking really slow. If I re-encode the "equivalent" SQL query manually it run fast as it should be but if I run the TSQL query that EF generated behind-the-scene it was terribly slow.
Somehow the TSQL code that EF generated was not optimized at all - maybe because it doesn't have a unique identifier.

So what I did is I just didn't use EF for that project because I can't touch or add unique identifier on those tables that I need to use.

Monday, 11 May 2015

Proxy Authentication error when accessing web service using Visual Studio

To configure a Visual Studio project to use your IE / Chrome proxy authenctication settings include these lines in your web.config.
-----------------------------------

<system.net> 
<defaultProxy useDefaultCredentials="true" /> 
</system.net>