Switching to Visual C Sharp Programming From Visual Basic

December 2nd, 2011 by

If you’re learning to program in Visual C# for the first time, but you’ve got a background in VB or VBA programming, this is the article for you! It summarises the main concepts which you’ll need to get used to. Let’s begin with the thorny topic of declaring variables, and then move on to case sensitivity.

Declaring Variables

In C# you put the type of the variable first, then its name, and then (optionally) its value. For example:

int i = 1;

This command would create a variable of type int, which is called i and which will hold the value 1.

Case Sensitive Variables

Suppose that you want to create a variable to hold an integer, and you want to call it MyInteger. You type in the following code:

int MyInteger = 0; lblExample.text = myinteger.tostring();

This will give you an error, since MyInteger and myinteger aren’t the same thing. In Visual C#, everything is case sensitive. The good news is that gives you 52 letters to play with, not 26 – the bad news is that you’ll have to write everything carefully.

This keyword

In C#, use this to refer to the current object, rather than me. For example: this.lblExample.text = ‘hello’;

Other changes

The above examples illustrate a number of other changes for Visual C# programming. These include:

* You must end all commands with a semi-colon;
* You must put brackets after certain functions (for example, ToString() above);
* You must use single quotation marks to enclose strings of text.

If Statements

If you want to create an IF condition, you’ll certainly have to learn how to type in curly brackets on your keyboard! Here’s a simple condition:

if (i-1) { lblExample.text = ‘one’; } else { txtExample.text = ‘not one’; }

You can see from the above example that in Visual C# programs the condition has to go in round brackets and the statements which follow the condition have to go in parentheses. You can have an else statement, and this is followed also by a series of statements to be executed in curly brackets.

Other Differences

There are many other differences when you’re programming in Visual C#. For example:

* When you’re looping over collections, you’ll use the for each keyword;
* When you’re declaring arrays or referring to subscripts in arrays, you’ll learn to use square brackets rather than round ones;
* Calls to properties use different syntax (although the concepts are the same)

I find that programming in Visual C# – once I get used to it – is no harder than programming in VB, provided that I remember that everything is case-sensitive!

Tips for Microsoft Outlook

December 1st, 2011 by

Microsoft Outlook is the most used email due to the fact that it is widely spread within almost all organizations.

There are a few ways you can enhance the usability and work flow with your Outlook client. The first thing most users do not know, Microsoft warns users not to keep PST files larger that two GB. If your PST goes over two GB, you might risk losing some data and Outlook will start performing slower and even cause client hangs. In this case, there is a tool available on Microsoft forums that split large PST files into smaller ones.

When Outlooks starts hanging, performs slow or fails to open folders, you might want to scan your PST files. To do that, use the SCANPST.EXE tool located in Program Files, within the Office 14 folder in the Microsoft Office directory. Depending on your offline folder size, an error scan could take up to 30 minutes, but it should fix most error.

You can also use keyboard shortcuts for common Outlook actions to speed up the time it takes to perform them. You can create a new email by hitting CTRL+N and ALT+S to send it. When you want to find a contact within your organization but do not know his exact address, only partially his email, you can hit CTRL+K and if the contact is found, his email will be auto filled. Also, you can use shortcuts while typing to improve the work flow. Simple shortcuts like CTRL+B to activate/deactivate bolded font or CTRL+I for italic, CTRL+U for underlined text will help a lot.

Another thing you might not know about Outlook, recovering deleted items is not activated by default. You will have to perform some registry editing to activate this feature. To start, press Windows key+R. In the command box, type regedit. In the registry editor expand and go to “My ComputerHKEY_LOCAL_MACHINESoftwareMicrosoftExchangeClientOptions”. You will want to create here a new registry key. Just go to “Edit” menu, find the “New” section and click on “DWORD Value”. Type “DumpsterAlwaysOn”. For this newly created entry, set the “DWORD” value to 1. Once done, restart Outlook. This option, will allow Outlook to recover items deleted even from the “Deleted Items folder”.

Another useful feature of Outlook that comes handy at times is increasing the font of received emails. When you find an email difficult to read, you can always increase the font just by holding CTRL and scrolling the mouse wheel. This can make a rather large in content email, easy to read even at distance.

SharePoint Information Management Policies

December 1st, 2011 by

An information management policy is a collection of rules that control how organizational information is controlled. With the policies, SharePoint development becomes a comprehensive tool for information management, access controlling, and compliance enforcement. A contains multiple rules, also called as policy features, that govern how to access what information; that can perform what actions, and the time frame the privileges are active. The helps in easier compliance with legal/governmental regulations and internal business processes. Usually the creators and enforcers of policies are compliance officers, records managers, IT staff, and others who are involved in organizational risk management. When applied along with SharePoint WCM development (Web content development), policies enable consistent and risk-free management of data resources.

Benefits of SharePoint policies

* System administrators can manage both client-side and server-side features from a single location
* Policies are coupled to the content that it applies to
* Policies do not require end-user involvement – the corporate policies are followed automatically and universally

Different ways of creating a policy for a site

* Creating a policy for different types of content within a site
* Creating for a given site content type
* Creating for a content library or list

The capability to set control parameters makes it possible to outsource SharePoint development. A brief description of how to create policies follows.

1. Developing a policy for different types of content within a site

Create a policy at the site collection level and then apply it’s to relevant content types as part of SharePoint WCM development – this ensures that the policy is applied to all documents of a certain type within a site collection. These are referred to as site collection policies. To do this

* Click “Site Actions” on the site collection home page
* Click “Site Settings”
* Select “Site Collection Administration” list
* Then select the tab “Site collection policies”
* Click “Create”
* Give a name and describe the policy
* Write a policy statement of up to 512 characters detailing the policy for users
* Click “OK”

2. Development a policy for a given site content type

SharePoint development allows setting a new policy for a given content type. Alternatively, an existing policy can be associated with a content type. Creating policies for content types allows easier coupling of policy features across lists or libraries, especially when you outsource SharePoint development. To do this

* Click “Site Actions” on the homepage of the collection
* Click “Site Settings”
* Click “Site content types” present in the “Galleries” section
* Choose the content type on the “Site Content Type Settings” page
* Select “Information management policy settings” in the “Settings” section of the “Site Content Type” page
* Click on “Define a policy” on the page with “Information Management Policy Settings”
* Give a name and describe the policy in the “Edit Policy” page
* Write a statement of up to 512 characters detailing the policy for users
* Select the relevant policy features to add to the information management policy in the next sections
* Click “Enable Retention” to pinpoint the retention time-frame for different items and documents that this applies to
* Click “Enable Auditing” to enable auditing of events for different items and documents that this applies to
* Click “Enable Labels” to specify label settings for documents and items that this policy applies to

3. Developing a policy for a content library or list

To set to a content library or list, at least the “Manage Lists” permission is necessary in the SharePoint development architecture. Management of rights is essential when you offshore SharePoint development. A retention can be defined for a specific list, library, or folder.

* Navigate to the list or library from where the information management policy has to be set
* Click “Library” or “List” tab
* Click “Library Settings” or “List Settings”
* Click “Information Management Policy Settings” under “Permissions and Management”
* Ensure the source of retention for the list or library is set to “Library and Folders”. If “Content Type” appears as source, change this by clicking “Change Source”
* Enter a description for the policy in the “Library Based Retention Schedule” section of the “Edit Policy” page
* Click “Add a retention stage…” under “Non-Records” to select the retention period option to specify when documents or items are set to expire
* Select “Repeat this stage’s action…” under the “Recurrence” section to enter how often the action should reoccur.