ITTreats.com
Enter your Search term and Hit "Enter"

Sat, 20 Mar 2010 12:15:47 PM +00:00

Latest 'ITTreats'


Calculate Page Execution time in PHP

Calculate Page Execution time in PHP

For those people who want to give users that in how many seconds actually your web page loaded completely. This script will be useful for you. There are so many ways to do this ( As usual ) but the classic approach would be

Step 1 : make a note of  the time when your page get starts

Step 2: make a note of  the time  at the end of your total page execution

Step 3 : step 2 – step1, You will get your page execution time

In simple   Here is the function  which will do it for you .

You have  to   call the function at the  start  and   echo  it  at the  end.   simple !!!!

More . . .

Adding Sub MenuItems to the Context Menu Item Dynamically

Adding  Sub MenuItems to the Context Menu Item Dynamically

You can’t add sub menuitems to a Context Menu Item Programatically for more than one time.

If you try to add first sub menu item it will add up into the list then again if you try to add then the sub menu items wont be displayed,

but if you debug it you will find the Submenu Items will still there .

This is Bug in .NET to over come this problem , toggle the visiblity of the added menuitem submenuitem1.visible=false; submenuitem1.visible=true;

Processing Web Request from c#.net/vb.net

Processing Web Request  from c#.net/vb.net

To process  web request from c#.net/vb.net windows application we have  WebRequest Class.

import  System.Net,System.IO name spaces  for requesting and processing the result

here is the example code

1. create a uri with the required URL   Uri wsn=new Uri(\”http://www.ITTreats.com\”);

2.Next  create a webRequest class and pass the above uri object to it   WebRequest wr=WebRequestFactory.Create(wsn)

3.  Now, capture the response of the  address   WebResponse wresp = Wr.GetResponse();

4. assaign the data to stream   StreamReader  sr=new StreamReader(wresp.GetResponseStream(), Encoding.ASCII);

5. Proceed with your further  coding requirements

How to Hide when form is minimized

How to Hide when form is minimized

To Hide a Form when minimize button is pressed, we have to write a event for Form Sized Changed event in that,
add this condition

if (this.WindowState == System.Windows.Forms.FormWindowState.Minimized) { this.Visible = false; }

working with Notify Icon and Context menu

working with Notify Icon and Context menu

Working with  Notify Icon and Context menu is simple
please follow the  steps

1. Drag and Drop the NotifyICon, Context Menu from the Tool Box

2. Change the names and text of the controls

3. Now, Create the Required Menu  for the COntext menu
for eg: add the Cut,Copy,Paste,Delete  Menuitems to the  context Menu

4. Now  Attach this context menu to the notify icon ,  by  selecing the  appropriate context menu  ,   You can do this  from the properties of the Notify Icon, change the appropriate context menu name.

Now  handle the  Proper Events  depending on your requrement for contextmenuitems

!! Happy Coding !!