Handle Click Event of Eclipse: Windows Application

Normally we don’t have any event for the Drawing objects like circle, eclipse ect., so here I am trying to draw a eclipse using graphics and try to give clicking effect and handing that event.

Declare the event handler and delegate to handle the events

image

Initialise the Click Event for eclipse we are drawing in Form_Load

image

Draw eclipse in Form paint method

image

To give clicking effect we need to draw a similar eclipse when you 
press the mouse, also check the bounds where mouse is being clicked, please add following code in Form1_MouseDown

image

And add following code in Form1_MouseUp

image

Following event will be called when you click the eclipse, so please add following code block

image

Now we are ready our code just build, run and test.

Tags: Drawing in C#, Eclipse, Handling Events

Reading Outlook Contacts in VB.NET

In this article I am trying to read the Outlook contact into a Combo Box and selecting a contact I am displaying his/ her details in below Label controls, so lets start building example.

Create a Windows Forms Application and Add Label and Combo Box and change the lable text to Select Contact.

To use the Outlook object in our project we need include a dll from the add references, now add a reference and select "Microsoft.Office.Interop.Outlook" dll from the list.

After adding the dll, now we will import the name space for that use following import

To access Outlook we need to create a object for Outlook via its interface and to get current session we need a NameSpace object to create these object use following code

Imports

Now in the Form Load we will initialise the objects and fill the combo box with contact names, for that in the Form_Load use following code

FormLoad

Once we get the list of contacts in the Combo box use will select a Contact on selecting a contact we will display his or her details in the labels we put on the form for that we need to add following coding in the ComboBox_SelectedIndexChanged event, basically we are searching through all contacts and get the selected contact and display his or her details

We need to clear the object memory we used in the project in Form_Disposed event

ComboBoxSelect

Now we are ready with our code just build, run and test

Output

Tags: Reading Outlook Contacts using VB.NET

Microsoft Tech-Ed 2009 At Hyderabad

 

Microsoft’s Tech-Ed is going to happen in Hyderabad this year, you can here latest technology news from Microsoft speakers who are actually involved in developing that particular technology.

Tech-Ed is one place where you can make yourself ready for next generation technology, today’s economic scenario you need to be ahead of others so this Tech-Ed will help you to stay ahead of others.

You can know about the event at  Tech-Ed 2009

You can see what is the agenda at Day 1 Day 2 Day 3

You can register for the event at Register

Tags: Tech-Ed 2009, ASP.NET

Most Valuable Member : DotnetSpider.com

Today I have received The Most Valuable Member award from the DotnetSpider team, I am active on Dotnetspider.com forum from last 4 years.

Recently they introduced the MVM award for the best and quality contributors, I am very happy to receive this.

You can find the post at DotnetSpider MVMs and my profile in dotnetspider at My Profile

I am also happy for other members who got this award as this is prestigious to us.

Congratulations to all the Winners.

I would like to take this opportunity to thank each and every member in the forum.

Also I would like to thank editors, Raghav and Tony for your support towards me all the time.

Cheers,

Satish.

Creating Dynamic Controls, and Preserve them for alternate Page Loads : ASP.NET

Normally when you create a control dynamically means at runtime, on the next page load you will loose that control, that control will be no longer exists, in this example I am try to explain how we can store that controls and get them back.

Create a Web Application and Add one button to it.
In the page load add following code, in the following code I am creating a object of Control Collection and keeping it in the Session.

image

Now Doble click on button1 and add following code in Button1_Click event.
Here in this code I am storing all the controls created into control collection and saving into session.

image

now we are ready with code just build, run and test.

Tags: Creating Dynamic controls, ASP.NET, C#, Preserve the Dynamic controls

Saving, Retrieving Data in Smart Device Applications

In this example I am try to use SQL Compact Edition with Smart Device Applications.

We can store data and update the data in the device using SQL CE, so lets start building a example.

Create SmartDeviceProject and add 2 Forms to it, please design the Form1 & Form2 as displayed in the Screen shot.

Now lets create a SQL CE database file, for that please right click on the project add new file and select Database file and name it as Employees.sdf

After adding the database file, create a table with following fields.
ID int
Name nVarchar
City nVarchar
Designation nVarchar

Now we are ready with design part lets write some code to insert data into table.

Now double click on the Add button and add following code, in the following code we are creating SQLCeConncetion object and SQLCeCommand Object to insert the data into the .sdf file, it is almost similar how we insert data into normal SQL Server database, normally our database file will be saved on the device where the application is installed so I have taken the path of the .sdf and creating a connection.

Double click on the View button and create a object for Form2 where will show all the employees details.

Now open the Form2 and add grid and one button as shown in the screen shot above, in Form2_Load event write the code to fill the datagrid, double click on back button and write a code to go back to Form1

Now we are ready with our code let built, run and Test

Implementing Tabs using MultiView Control : ASP.NET

Using MultiView control in ASP.NET we can achieve tabs in a web page, now in this example I am going to explain how we can create tabs using MulitView control

Create a web application and add a Table control with 1 row and 3 columns and a MultiView control with 3 views, you can refer below screen shot

 

Here we are adding 3 cells using table control and each cell will have a link button which acts as Tab

image

We need to set ActiveViewIndex property of a MultiView control to see particular tab for that initially in Page_Load we set ActiveViewIndex to 0 and on clicking every link we will call TabChange event to show the particular tab, in the below code we identify which link button is clicked and based that we will change the ActiveViewIndex to show the contents

image

Now we are ready with out code, just build, run and test

Hope this helps

Tags : Tab control in ASP.NET, MulitView control, Satish Kumar J