Tuesday, June 5, 2012

.Net 3.5 OpenFileDialog issue in Windows SP3

Recently me and my co-worker found a strange issue while developing something where we used a c++ dll imported from .net project. Inside the c++ dll we have used some relative paths which is needed on each operation to load resources. If we use OpenFileDialog in c# before calling the method of the c++ dll it changes the current directory and the dll not able to find the path. Here is the source code for better understanding:

  OpenFileDialog opd = new OpenFileDialog(); 


 if (opd.ShowDialog() == DialogResult.OK) 
 {


 }


 moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here 

Above code unfortunately do not work on my co-workers machine. He is using windows xp sp3. The fun part is that the same code works properly in my machine which is windows 7. We both used same .net framework. In my co-worker's machine if he uses the below code it works perfectly:

  /*
 OpenFileDialog opd = new OpenFileDialog(); 


 if (opd.ShowDialog() == DialogResult.OK) 
 {
 } 
 */


 moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here



Wednesday, January 18, 2012

Make visual studio 2008 winform design view faster

How to make faster winform design view faster:

The setting is in Tools -> Options -> Windows Forms Designer, set "AutoToolboxPopulate" to false.

See the image below:


Design view of visual studio 2008 is too slow (control movement slow) -- How to fix [web view]

I was struggling for this issue. Lets see how we can fix it quickly:

Download Updated VS2008 Hotfix KB967253

Download and Install

Issue:

If you work in design view of visual studio 2008, you will notice it is tremendously slow. In a word it is quite impossible to design a large form :(. The whole purpose of using visual studio is defeated here. We like vs for its quick design facilities.... Actually it a known issue of that vs version. So to fix it we need to download and install the above fix from microsoft.

Saturday, October 22, 2011

Select all text using ctrl + A in a TextField (multiline) C#

This is quite simple .... just add the keyDown event like below:

this.txtField.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtField_KeyDown);

You should add this event for those textfield only where you want to add this functionality ... Now just add below simple code and enjoy select all feature :D

private void txtField_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && (e.KeyCode == Keys.A))
{
((TextBox)sender).SelectAll();
e.SuppressKeyPress = true;
e.Handled = true;
}

}

Try and enjoy :)

Tuesday, October 4, 2011

Back again

Back again :)

After a long time I am back again and decided to post and write whatever I do. I will post basically technical terms in posts.....

Cheers 

My Family

My Family
Father Brother Me Mother

PC Magazine Tips and Solutions

PC World: Latest Technology News

PCWorld.com - Most Popular Downloads of the Week