Skip to main content

Posts

Get Application Execution path in .NET

Desktop Application System.Windows.Forms.Application.StartupPath Windows Mobile Application C# You should import using System.Reflection by using System.Reflection; Assembly asm = Assembly.GetExecutingAssembly( ); String path = ""; path= System.IO.Path.GetDirectoryName (asm.GetName().CodeBase);

How to Access Internet through Windows Mobile Emulator

To Access the web through your mobile emulater First of all you have to install Microsoft ActiveSync.  Link :  http://www.microsoft.com/windowsmobile/en-us/help/synchronize/activesync-download.mspx  Then close all running Mobile Emulators.  Then run ActiveSync. (you can run it also using taskbar icon)     Then Goto File Menu --> Connection Settings, and change settings as  Then Open Visual Studio, In there goto Tools --> Device Emulator manager and select the pertivular emulator.                 In Device Emulator Go to Action Menu and Select Connect. And cradle. Now you can see Microsft Active Sync status changing to connected.. .. now go to the web using your emulator.

Disable Windows Mobile Clock Access

To restrict windows mobile key access they are main two methods.  You can replace the clock.exe in the window folder by empty application.  You can change some registry values to prevent opening the clock. I will show how we can use C# to do it -----------------------------------------------------------------------------------  using Microsoft.Win32;   // import  Microsoft.Win32 top of the class file  Dissable the clock RegistryKey hklm = Registry.LocalMachine; hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true); System.Byte[] offValue = new byte[1]; offValue[0] = 0x30; hklm.SetValue("AppState", offValue); Enable the clock  RegistryKey hklm = Registry.LocalMachine;  hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true); System.Byte[] offValue = new byte[1]; offValue[0] = 0x11; hklm.SetValue("AppState", offValue);

Get and Compare the Control

Some of the time we need to know what kind ok control are we dealing with. This simple example mimics how to know what is our control. As an example say we want to go through the form’s controls and show a message if there were a text box. foreach ( Control n in this .Controls) { String tp =  "System.Windows.Forms.TextBox";     if (n.GetType().ToString() == tp ){           // Do something     } }     

Convert Visual Studio 2005 to 2008

Normaly Visual Studio (VS) converts 2005 projects to 2008 when we try to open our 2005 projects in Visual Studio 2008. But sometimes we are getting errors... There fore we need to manually converts 2005 visual studio projects to 2008.  This is the way to update 2005 visual studio projects o 2008. Open a Visual Studio Command prompt.  CD (goto) to the folder whitc your project in it. Issue this command, subbing in your own sln file name devenv /upgrade MySoln.sln

Recover Linux After Installing Windows

How to recover ubuntu (Whole in one partition) Open a terminal in the ubuntu using a live disk $ sudo grub then grub terminal will come up,in grub terminal run  $ find /boot/grub/stage1 then something like (hd0, 4) will be displayed,then run $ root (hd0,4) here (hd0,4) is the result from find command,then run  setup (hd0) here (hd0) is first part of the find result restart machine How to recover ubuntu (When boot partition seperately installed) Open a terminal in the ubuntu using a live disk $ sudo grub then grub terminal will come up,in grub terminal run  $ find boot/grub/stage1 then something like (hd0, 4) will be displayed,then run $ root (hd0,4) here (hd0,4) is the result from find command,then run  setup (hd0) here (hd0) is first part of the find result restart machine

Workshop in Nihiluwa Vidyalaya

Conducted five days workshop in Visual Basic, Mambo (Content Management System) and Microsoft Access for student of Nihiluwa Maha Vidyalaya in 2008 October 16.