Sunday, March 14, 2010

Pass values between 2 MDI Child Forms using C# and VB.NET

The contents of the post has been moved to here. Please follow the link to see the contents.

Sorry for the inconvenience.

Thanks!

Remove Empty Records from DataTable

The content of this post has been moved here. Please check this link to view the contents.

Sorry for the inconvenience.

Thanks!

Thursday, November 19, 2009

Office 2010 direct download link

Huh! Office 2010 Beta is out for public. I’d started downloading. What about you?

Here is the direct download link.

http://care.dlservice.microsoft.com/dl/download/office2010/2/4/7/247A463c-af98-4778-b5a3-934cb8d198d1/professionalplus.exe

Thanks.

Saturday, October 17, 2009

How to get time elapsed after loading a webpage

How to get the time elapsed time after loading a webpage, using Callback() in MS Ajax library. Here is a sample script;

[Ajax-Script]

   1: <script type="text/javascript">
   2:         // Page Load
   3:         function pageLoad() {
   4:             var loadTime = {date : new Date()};
   5:             var callback = Function.createCallback(onBtnClick, loadTime);
   6:             
   7:             $addHandler($get("Button1"), "click", callback);
   8:         }
   9:  
  10:         function onBtnClick(event, context) {
  11:             var loadTime = context.date;
  12:             var elapseTime = (new Date() - loadTime) / 1000;
  13:  
  14:             $get("Text1").value = elapseTime + " Seconds";
  15:         }
  16:     </script>

[HTML-Script]

   1: <form id="form1" runat="server">
   2:     <asp:ScriptManager ID="ScriptManager1" runat="server">
   3:     </asp:ScriptManager>
   4:     <div>
   5:         Time elapsed since PageLoad: 
   6:         <input id="Text1" type="text" />
   7:         <input id="Button1" type="button" value="Get Elapsed Time" />
   8:     </div>
   9:     </form>

Thanks.

Sys.ArgumentTypeException: Object of type 'String' cannot be converted to type 'Number'

Another careless mistake : when I used the setLocation() method in the DomElement class in Sys.UI namespace. I tried to set the location of a DIV element using the value which I read from a textbox and I’s thrown with the error:

Sys.ArgumentTypeException: Object of type 'String' cannot be converted to type 'Number'

After taking a close look, I found it. The setLocation() method clearly states that I’ve to enter the (x,y) coordinates as integer data type. Take a look:

msajax_setlocn

Aaahhh…!!! See how careless I’m. Soon, I fixed the small careless-bug using ParseInt() as

msajax_setlocn_2

Hope, you’ll be more careful.

Thanks.

 
Best viewed in Internet Explorer 8.