How to add an ActiveX component to a Visual Basic 2010 project

The components in our toolboxes, for example SamLogic Calendar Components and SamLogic Internet Components, are based on the ActiveX technology. That’s a component technology that was introduced already in 1996 by Microsoft, but it is still supported by many tools, including the latest versions of Microsoft Visual Studio and Microsoft Office.

1 month calendarIn this blog post we will show how to add an ActiveX component (control) to a Visual Basic 2010 project by using Microsoft Visual Studio 2010. We will add our one month calendar component from the SamLogic Calendar Components tool box to the Visual Basic project.

If you want to use the calendar component in your own project you must install SamLogic Calendar Components first. But you can also consider this tip as a general step-by-step tip that shows how to insert an ActiveX component into a VB 2010 project. The steps are the same also if you add another ActiveX component to your project.

How to add an ActiveX component to a Visual Basic 2010 project

1. Start Visual Studio 2010 and open a Visual Basic 2010 project, or create a new project. The project type must be Windows Form Application.

2. Right-click over the Toolbox window.

3. Select the Choose items menu item in the local menu that is shown.

Menu

4. The Choose Toolbox Items dialog box is now shown. In this dialog box, open the COM Components tab.

The 'Choose Toolbox Items' dialog box

5. If you have installed SamLogic Calendar Components and want to use the 1 month calendar, select SamLogic SLXCal Control in the list (in the COM Components tab). Otherwise, select the ActiveX component that you want to use.

6. Click OK to close the dialog box.

7. The selected component should be visible in the Toolbox window; probably in the bottom of the window.

8. Now drag and drop the component on the Windows form, in the position that you want to have the component.

The one month calendar component placed on a Windows form

That’s all steps that we need. We have now included an ActiveX component into a Visual Basic 2010 project and put it on a form! You can use the ActiveX component in a similar way as a visual .NET component / .NET class.

The calendar component’s event handlers
If you double-click on the calendar component in the form, the DateChanged event handler is created in the source code (as seen in the picture below):

The DateChanged event

The DateChanged event occurs when a user changes month in the calendar (for example by clicking on the right arrow). From the event handler dropdown list in Visual Studio’s source code editor you can choose another event handler for the calendar, for example the DateSelected event handler. The DateSelected event occurs when a user selects a date in the calendar by clicking on a date (day number) with the mouse button. There is also a DateDeselected event handler that is fired when somebody unselects a date (removes a selection) in the calendar, for example by clicking with the right mouse button.

More information about the one month calendar component
More detailed information about the one month calendar component in SamLogic Calendar Components, including a complete list of all properties, events and methods in the component, is available on this web page:

> One-Month Calendar Component (ActiveX)

In the next blog post
In the next blog post we will show how to insert an ActiveX component in an Excel sheet. We will use the same calendar component as above in the example, but the tip can also be used for other ActiveX components.

Visual Calendar ActiveX Components – from SamLogic Software

If you have clicked around on our web site you may have noticed that we also sell components for developers, in addition to our programs. We have two component libraries for software developers, that can be used in software development projects:

– SamLogic Calendar Components
– SamLogic Internet Components

SamLogic Calendar Components
1 month calendarSamLogic Calendar Components is a library that contains visual calendar ActiveX components that can be used in software (for example in desktop applications) to show years, months, dates, week numbers, holidays etc. visually. Three types of calendars are included in the calendar component library: 1 month calendar, 6 month calendar and 12 month calendar. In the picture to the right you can see how the 1 month calendar looks like.

Localized calendars
The calendars in SamLogic Calendar Components can be localized to all major western countries in the world, for example USA, United Kingdom, Germany, France, Spain. Also some small countries as Sweden, Norway and Finland are supported. When a calendar is localized, the calendar interface is shown with text in the country’s major language, and the holidays that are shown are based on that country’s official holidays. You can choose if you want to have Monday or Sunday as the first day of week.

SamLogic Internet Components
SamLogic Internet Components is a library with ActiveX components for the Internet. For example components for e-mail, FTP, time servers, WHOIS servers, ping tests etc. Some general components for log handling, alarm, high-resolution timers etc are also included in the tool box.

Can be used with Microsoft Visual Studio and Microsoft Office
The ActiveX components in SamLogic Calendar Components and SamLogic Internet Components can be used in Microsoft Visual Studio (for example with Microsoft Visual Basic) and in Microsoft Office (for example with Microsoft Excel and Microsoft Access). Visual Studio 6.0 and Visual Studio 2002 – 2012 are supported. And all versions of Microsoft Office since Office 95 (!) until the newest Office 2013 are supported.

Can also be used with Embarcadero Delphi
The ActiveX components in the libraries can also be used with Embarcadero Delphi (former Borland Delphi). The components can be used with all tools that can handle ActiveX files.

In the next blog posts
In the next two blog posts we will show how to use a calendar ActiveX component from SamLogic Calendar Components in Microsoft Visual Basic 2010 (Microsoft Visual Studio 2010) and in Microsoft Excel 2010. It is quite easy to include an ActiveX component in an Visual Basic application and Excel sheet, when you know the necessary steps. Below are direct links to the two blog posts, where we describe this step by step:
> How to add an ActiveX component to a Visual Basic 2010 project
> How to add an ActiveX component to an Excel 2010 sheet

In a third blog post we will inform about how to install an ActiveX component in a Windows system, so other applications can access the component:
> How to install (and register) an ActiveX component

How to remove the ‘Windows protected your PC’ message

The “Windows protected your PC” message is displayed by the Windows SmartScreen function in Microsoft Windows 8 when you try to run an application (app) or run a setup package, downloaded from the Internet, that Windows do not recognize, or consider as unsafe. This is to protect you against malicious software (malware) which is very common on the Internet today.

In the informative Windows SmartScreen – Anti-Malware Protection in Windows 8 article on our website we discuss this warning message, and Windows SmartScreen, in detail.

Windows SmartScreen - Windows protected your PC

How to remove the warning message
Although this protection is very good and can prevent that malware is installed in your computer, there may be situations when you want to have this function turned off. If you for example are a software developer and frequently download your newly compiled software from the Internet, this message may be somewhat annoying. But it is possible to turn off Windows SmartScreen and stop this warning message from appearing.

In the following article we show you, step by step, how to disable Windows SmartScreen in Microsoft Windows 8:

> How To Disable / Turn Off Windows SmartScreen in Windows 8

Protect your Windows 8 system with Windows SmartScreen

Every time you download a file from the Internet there is a risk that your computer gets infected by virus or another malware. But web browsers and operating systems are getting better and better in their effort to protect a computer against viruses / malware, and in Windows 8 there is a feature named Windows SmartScreen that helps protect your system against malicious software that has been downloaded from the Internet. Windows SmartScreen is reputation-based protection system, and how it works is described in this article on our web site:

> Windows SmartScreen – Anti-Malware Protection in Windows 8

Where is the Start button in Windows 8?

Many users that have tested Windows 8 were very surprised the first time they run Windows 8. It differs a lot from previous versions of Windows, and the first thing many wondered was: where is the Start button?

The truth is that there is no Start button anymore! It has been removed! And there is no Start menu either. In this article you can read why:

> Why Were the Start Button & Start Menu Removed in Windows 8?

The article also informs you about how to bring back the Start button (and Start menu) by using third party software.

Setup of a VB 6.0 program

Many programmers still use VB 6.0
There are still lots of people that develop software with VB 6.0 (Visual Basic 6.0). VB 6.0 is an excellent programming language and programming tool that can be used to create a desktop program for the Windows system. A created program starts fast and runs fast also in an average computer, and by using a third party component like CommandBars from CodeJock, the VB6 desktop program can have a modern user interface, even with ribbons!

Not suited for large projects or Internet projects
However, for large projects or for applications that uses the Internet a lot, Visual Basic .NET is the preferable language. And if you are new to programming you should of course choose Visual Basic .NET for your software projects; for example the new Microsoft Visual Basic 2012. VB 6.0 is an old technology, and even if Microsoft still supports it to 100% in their Windows operating systems, this will not last forever.

The Package and Deployment Wizard
Many of our customers use VB6 for their projects, but the setup tool that follows Visual Basic 6.0 – the Package and Deployment Wizard – is quite limited, and it is difficult to create a professional setup program with a modern user interface using that tool. If you want to deploy a setup program with a professional and modern user interface you should use an external setup tool instead of the Package and Deployment Wizard.

Setup of a VB 6.0 program
A complete VB6 application consists of different types of files. For example an EXE file (the main program), ActiveX component files, DLL files, type libraries etc. So it is not possible to just take the EXE file and copy it to another computer. It will not work, unless all support files already have been installed with a previous installation. But to be sure you should always distribute and install all files that are needed to run your program.

It is also very important to install the files to the correct folders on the hard disk, especially in a 64 bit computer / 64-bit Windows. And many files, for example ActiveX components, also need to be registered in the system. Also other information need to be registered. Doing this manually is mostly too complicated, so a setup program is a must.

SamLogic Visual Installer has powerful functions for setup of VB 6.0 programs
Our setup tool SamLogic Visual Installer has powerful functions for setup of VB 6.0 programs. It can install VB6 program files, ActiveX components, DLL files, type libraries, databases, database engines (DAO, ADO, RDO etc.), and other types of files, in an automatic way. By analyzing your VB project file (the .VBP file) Visual Installer will know which files to include in the setup project. Visual Installer will collect the files automatically.

Visual Installer will also add a professional and modern user interface to your installation. Visual Installer can also handle license keys or password protect your installations. Created installations can be code signed and multiple languages can be used for an installation.

Supports Windows 8 and Windows 10
Visual Installer supports new operating systems like Windows 8 and Windows 10, but can also be used to create installation packages for older Windows like Windows 2000 and Windows XP.

More information
If you want to read more about the SamLogic Visual Installer setup tool, you can click on the links below:

> SamLogic Visual Installer – a professional installation software
> Visual Installer can create a setup package for your Visual Basic project

Detailed information about how to import a VB 6.0 project file and create an installation of it is available in this step-by-step tip on our tips & tricks section:

> How to create an installation for a VB6 application

How to install an application / app in Windows 8

A few months ago Microsoft released Windows 8 and software developers had once again a new operating system to take into account for their applications and installation of applications. One big difference from previous Windows version is that there is now two different running environments to consider: an environment for traditional desktop applications (Windows Desktop apps) and one environment for the new simpler touch-optimized apps (Windows Store apps).

Different installation methods
The installation method is very different dependent of you want to install a Windows Desktop app or a Windows Store apps. In the following two articles on our web site we describe how to install an application / app in Windows 8 in both environments:

> How to install a desktop application / desktop app in Windows 8
> How to install a Windows Store app in Windows 8

Note. An “application” and an “app” are the same thing. Since the release of Windows 8, Microsoft has started to call “applications” for “apps” in their documentation. An application that is run on the traditional desktop is named “Windows Desktop app” and an app of the new touch-optimized kind (former Metro-style app) is named “Windows Store app”.