Subscribe:

Pages

Thursday, November 24, 2011

Check whether Instance of window class file already created in current assembly

     In this post I tried to show a detail idea about how to execute exactly on instance to your window class. Then you can prevent open a window more than one.

1. Import Library file into your class


2. Get Currently running assembly file. This is a executable file in your project.


3. Get already created instance in your windows application


4. If your window class file not created instance in your project then you can create the instance to your window class.

Monday, November 7, 2011

Control ComboBox ItemSource using another ComboBox in DataGrid

In this post I try to show a detail Idea about how to control the data source in DataGrid ComboBox using another DataGrid ComboBox.

1. I add two resource keys into Data Grid. First resource key help to bind a datasource in ItemType ComboBox and second one help to bind a datasource in ItemName ComboBox according to ItemType ComboBox.


2. In the first data template column I try to bind the enum class as data source in my Item Type ComboBox.
 

3. In the second data template column in DataGrid bind a static resource as its item source.
 
This SetValueInBook class return the ItemSource in ComboBox.


4.  I create the Items type List to set the data source into ComboBox.

 

5. The ItemSourceof Item Name ComboBox,  changed when the selection changed of my Item Type ComboBox. You can set the data source into List item source.
 

Thursday, September 22, 2011

Working with Macro Enabled Excel Sheets in Code Behind

                  In this post I tried to explain about, how to work with the macro enabled excel sheet. Macro enabled excel use VBA (Visual Basic for Application) for functional purpose in excel sheets. This post is a part of my Retrieve data from excel file in code behind .

1. Import library into your application. I assign a name to that library for working easily.
    

2. Assign a values


3. Get the procedure name which use into your VBA code. 
          Macro name is the combined of component name  and procedure name. So you must concatenate this ComponentName and procedureName which I used in this application.

4. Application.Run method help to update your changes in your application.
     

Save your excel file as PDF document


              In my previous post, Retrieve data from excel file in code behind,I told you about how to work with the excel file. Purpose of this post is, giving a knowledge about how to convert your excel file into PDF format .

            
 For further details about Workbook.ExportAsFixedFormat Method.You can do same this for any other Microsoft Office document. If you have some problem while working this code, please install  Add-in to your PC.