<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Proper Way to Show the Wait Cursor</title>
	<atom:link href="http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/</link>
	<description>C# Development</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:14:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: chirag makwana</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-962</link>
		<dc:creator>chirag makwana</dc:creator>
		<pubDate>Tue, 08 Mar 2011 06:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-962</guid>
		<description>Hi..
I am creating Desktop application. 
when i am checked on checkedlistbox item at that time fire one query but problem is that record is 20 lakh..
when user click on Checkedlist item after fill the grid.. 
but problem is that record is 20 lakh so take a time for 10 min..... 
so how  can i use there image progress (gif file).

my code is :
private void Chklist_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i;
foreach (object itemchecked in Chklist.CheckedItems)
            {
                i = Convert.ToInt32(Chklist.Items.IndexOf(itemchecked));
                i = i + 1;
                catid = catid + &quot;,&quot; + i.ToString();
                if (catid.StartsWith(&quot;,&quot;) == true)
                {
                    catid = catid.Remove(0, 1);
                }
                 query =&quot;&quot;;
                 gridView1.Columns.Clear();
                obj.gridview(gridControl1, query); // here i am using method of gridview which is on class file.

}

Thanks in Advance...</description>
		<content:encoded><![CDATA[<p>Hi..<br />
I am creating Desktop application.<br />
when i am checked on checkedlistbox item at that time fire one query but problem is that record is 20 lakh..<br />
when user click on Checkedlist item after fill the grid..<br />
but problem is that record is 20 lakh so take a time for 10 min&#8230;..<br />
so how  can i use there image progress (gif file).</p>
<p>my code is :<br />
private void Chklist_SelectedIndexChanged(object sender, EventArgs e)<br />
        {<br />
            int i;<br />
foreach (object itemchecked in Chklist.CheckedItems)<br />
            {<br />
                i = Convert.ToInt32(Chklist.Items.IndexOf(itemchecked));<br />
                i = i + 1;<br />
                catid = catid + &#8220;,&#8221; + i.ToString();<br />
                if (catid.StartsWith(&#8220;,&#8221;) == true)<br />
                {<br />
                    catid = catid.Remove(0, 1);<br />
                }<br />
                 query =&#8221;";<br />
                 gridView1.Columns.Clear();<br />
                obj.gridview(gridControl1, query); // here i am using method of gridview which is on class file.</p>
<p>}</p>
<p>Thanks in Advance&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith L</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-961</link>
		<dc:creator>Keith L</dc:creator>
		<pubDate>Mon, 07 Feb 2011 07:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-961</guid>
		<description>p.s. should be (- - mMouseDepth==0) not -mMouseDepth.</description>
		<content:encoded><![CDATA[<p>p.s. should be (- &#8211; mMouseDepth==0) not -mMouseDepth.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith L</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-960</link>
		<dc:creator>Keith L</dc:creator>
		<pubDate>Mon, 07 Feb 2011 06:58:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-960</guid>
		<description>//Try this In a static class:
        private static int mMouseDepth = 0;
        public static void IncMouse()
        {
            if (mMouseDepth++==0)
            {
                System.Windows.Forms.Application.UseWaitCursor = true;
                System.Windows.Forms.Application.OpenForms[0].Refresh();
            }
        }

        public static void DecMouse()
        {
            if (mMouseDepth == 0) return;
            if (--mMouseDepth == 0)
                System.Windows.Forms.Application.UseWaitCursor = false;
        }


//Put an IncMouse at begininning of procedure and a decmouse juts before exit (take care on early/conditional exits ). The counter means that nested calls to IncMouse and DecMouse will not interfere with each other (such as an inner procedure restoring cursor to default before outer procedure has finished).

Application.OpenForms[0].Refresh ensures that the mouse cursor gets repainted on outermost call to IncMouse. Could also use Application.Doevents() to do this, but be careful that user does not trigger another event [e.g. could disable form etc]. Does anyone know a better way to refresh the mouse? e.g. something like cursor.refresh. btw, I think that when some people experience that usewaitcursor does not seem to work it is because the cursor does not get repainted</description>
		<content:encoded><![CDATA[<p>//Try this In a static class:<br />
        private static int mMouseDepth = 0;<br />
        public static void IncMouse()<br />
        {<br />
            if (mMouseDepth++==0)<br />
            {<br />
                System.Windows.Forms.Application.UseWaitCursor = true;<br />
                System.Windows.Forms.Application.OpenForms[0].Refresh();<br />
            }<br />
        }</p>
<p>        public static void DecMouse()<br />
        {<br />
            if (mMouseDepth == 0) return;<br />
            if (&#8211;mMouseDepth == 0)<br />
                System.Windows.Forms.Application.UseWaitCursor = false;<br />
        }</p>
<p>//Put an IncMouse at begininning of procedure and a decmouse juts before exit (take care on early/conditional exits ). The counter means that nested calls to IncMouse and DecMouse will not interfere with each other (such as an inner procedure restoring cursor to default before outer procedure has finished).</p>
<p>Application.OpenForms[0].Refresh ensures that the mouse cursor gets repainted on outermost call to IncMouse. Could also use Application.Doevents() to do this, but be careful that user does not trigger another event [e.g. could disable form etc]. Does anyone know a better way to refresh the mouse? e.g. something like cursor.refresh. btw, I think that when some people experience that usewaitcursor does not seem to work it is because the cursor does not get repainted</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yash thakkar</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-959</link>
		<dc:creator>yash thakkar</dc:creator>
		<pubDate>Fri, 28 Jan 2011 11:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-959</guid>
		<description>simply useful....

implemented and fixed !!!</description>
		<content:encoded><![CDATA[<p>simply useful&#8230;.</p>
<p>implemented and fixed !!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lavi Gupta</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-958</link>
		<dc:creator>Lavi Gupta</dc:creator>
		<pubDate>Sat, 06 Nov 2010 19:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-958</guid>
		<description>Cursor.Current = Cursors.WaitCursor;

does not work at all.

this.UseWaitCursor = true;  is working.</description>
		<content:encoded><![CDATA[<p>Cursor.Current = Cursors.WaitCursor;</p>
<p>does not work at all.</p>
<p>this.UseWaitCursor = true;  is working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-957</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Mon, 11 Oct 2010 11:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-957</guid>
		<description>I want to use a custom cursor as my WaitCursor.  Any idea how to override the default system WaitCursor or set Application.UseWaitCursor to False and &quot;lock&quot; it so the system won&#039;t just decide to overwrite my custom cursor?</description>
		<content:encoded><![CDATA[<p>I want to use a custom cursor as my WaitCursor.  Any idea how to override the default system WaitCursor or set Application.UseWaitCursor to False and &#8220;lock&#8221; it so the system won&#8217;t just decide to overwrite my custom cursor?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chen</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-956</link>
		<dc:creator>Chen</dc:creator>
		<pubDate>Mon, 23 Aug 2010 22:44:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-956</guid>
		<description>According to MSDN:

However, note that operations that block the UI thread will also block a cursor change. Therefore, this property should only be used when performing time-consuming operations in another thread. To change the cursor globally and immediately, see the Current property.</description>
		<content:encoded><![CDATA[<p>According to MSDN:</p>
<p>However, note that operations that block the UI thread will also block a cursor change. Therefore, this property should only be used when performing time-consuming operations in another thread. To change the cursor globally and immediately, see the Current property.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-955</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Mon, 22 Feb 2010 14:21:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-955</guid>
		<description>When I use: 

Application.UseWaitCursor = true;

Before I start a foreach which takes a wile the cursor does not change. For each object in the foreach I do some actions 

Using

Cursor.Current = Cursors.WaitCursor;

Does work

Any ideas
Danny</description>
		<content:encoded><![CDATA[<p>When I use: </p>
<p>Application.UseWaitCursor = true;</p>
<p>Before I start a foreach which takes a wile the cursor does not change. For each object in the foreach I do some actions </p>
<p>Using</p>
<p>Cursor.Current = Cursors.WaitCursor;</p>
<p>Does work</p>
<p>Any ideas<br />
Danny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ann</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-954</link>
		<dc:creator>Ann</dc:creator>
		<pubDate>Fri, 12 Feb 2010 18:49:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-954</guid>
		<description>Works perfectly!  I am so glad I found this simple solution when I couldn&#039;t get &quot;wrong way&quot; to work.</description>
		<content:encoded><![CDATA[<p>Works perfectly!  I am so glad I found this simple solution when I couldn&#8217;t get &#8220;wrong way&#8221; to work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-953</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Tue, 15 Sep 2009 03:15:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/the-proper-way-to-show-the-wait-cursor/#comment-953</guid>
		<description>Mate.... You legend.
I guess I was lucky. The &quot;wrong way&quot; just was not working, so I had to find the &quot;right way&quot;.
Thanks</description>
		<content:encoded><![CDATA[<p>Mate&#8230;. You legend.<br />
I guess I was lucky. The &#8220;wrong way&#8221; just was not working, so I had to find the &#8220;right way&#8221;.<br />
Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

