.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to start and stop thread with button

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

hi all,

i am new to threading.

im trying to write a simple application which will update a textbox (on other thread) when button clicked.

and stops when clicking on "stop".


when i click on the "start" it  starts but for some reason the app freezes, when i debug the prog i can see it  is running  but the main window stays frozen.


please help.

View Complete Post

More Related Resource Links

Editor's Note: new Thread(ReadEditorsNote).Start(); yourAttention.WaitOne();


Introducing the issue, Howard Dierking points out that you can't simply parallelize your code blindly if you expect to truly reap the benefits that parallelism promises.

Howard Dierking

MSDN Magazine October 2008

How can I get a list of users that are able to start/stop/execute jobs on sql server?

I know that the users with sysadmin roles are able to start/stop/execute jobs but I wonder if there are another roles or permissions that enable users to do this.   regards,

How to start/stop SharePoint 2010 Services manually?



I am new to SP 2010.  Recently, I installed SharePoint 2010 on Windows 7 (4GB RAM), which is taking up most of my system RAM and I am unable to run any New Virtual PC within my Host.  I would like to start/stop SharePoint 2010 manually on this PC.

What are the steps (in proper sequence) involved to start/stop all SharePoint 2010 related services manually? 

Thanks & Regards,
Kamlesh | Blog | Twitter 
Posting is provided "AS IS" with no warranties, and confers no rights.

adding play / stop button to a simple slide show


Hi guys,

I got the following code with the help of raghav khunger and I wanna add a play and stop button on it to cycle the pictures orderly and stop them. how can I do that?

<%@ Page Language="C#" %>

<%@ Import Namespace="System.Web.Services" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <style type="text/css">
            width: 100px;
            height: 100px;
            width: 400px;
            height: 300px;
    <form id="form1" runat="server">
    <asp:Image ID="imgMain" CssClass="main-image" runat="server"  ImageUrl="http://www.clubalbuquerque.com/files/images/15%20Random%20Greenery.JPG"/>
    <br />
    <div id="thumb-container">

Unable to start/stop SharePoint 2010 service



I've developed customs SharePoint 2010 Service based on this tutorial: http://blogs.msdn.com/b/dtaylor/archive/tags/calculator+service+example/

My first version inherits from SPIisWebService (and SPIisWebServiceInstance, SPIisWebServiceApplication etc..) - everything worked fine.

Then I redesigned my service to inherits from SPWindowsService (and SPWindowsServiceInstance, SPWindowsServiceApplication etc...). Everything works fine without one thing:) - I'm not able to start or stop Service (neither from PowerShell nor SP Central Admin page). After installed my service, it is started. When I uninstall it and install once again - it's still started.

When I try to stop it (or start on clear SharePoint environment), I've got the following exception (where IntegrationService is the name of my service)

System.ComponentModel.Win32Exception: IntegrationService
at Microsoft.SharePoint.Win32.SPAdvApi32.SetServiceStartupType(String serviceName, Int32 startupType)
at Microsoft.SharePoint.Administration.SPWindowsServiceInstance.Provision(Boolean start)
at Microsoft.SharePoint.ApplicationPages.ServerPage.OnObjectModelAction(Object sender, ObjectModelActionEventArgs e)
at Microsoft.SharePoint.WebControls.ActionLinkDataSourceControl.OnObjectModelAction(ObjectModelActionEventArgs e)
at Microsoft.SharePoint.WebControl

Stop arrow keys from checking radio button

I have a complaint from the customer that they're accidently switching radio buttons with the arrow keys. Is there a simple way to ignore the arrow keys if they're on a radio button? Or make it change focus instead?

How can I stop this thread?


Hi all. I want to stop a thread in my app by click on button3.

What should I do?

public void Button1_Click(object sender, EventArgs e)
            Cache["t"] = 0;
            Thread thr = new Thread(new ThreadStart(func));
            Cache["thr"] = thr;
            thr.Name = "thr";
        public void func()
            System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(timerTick), null, 0, 1000);
            Cache["timer"] = timer;
        private void timerTick(object a)
            int b = Int32.Parse(Cache["t"].ToString());
            Cache["t"] = b;
            SqlConnection con = new SqlConnection();
            con.ConnectionString = "server=pc5;database=test;integrated security=true";
            SqlCommand com = new SqlCommand();
            com.CommandText = "update t2 set[count]=" + Cache["t"].ToString() + " where id=1";
            com.Connection = con;

        protected void Button2_Click(object sender, EventArgs e)
            Label1.Text = string.Empty;
            Label1.Text = Cache["t&quo

BIDS SQL 2008 sp2 "The query processor could not start the necessary thread resources for parallel q


These cubes have been working in SQL 2005 on another box.  I copied the SQL db and the SSAS Project over to this new box and a fresh install of SQL 2008, sp2 Std Ed, 32 bits. Box has Server 2003 R2 Enterprise Ed SP2,

• 2x 2.3GHZ
• 12GB RAM
• D: 120GB SSD Drive Partition For Data
• C: 73 GB Drive Partition for System
• 1 GB NIC

A few of the dimensions will not refresh, they give the message  
"The query processor could not start the necessary thread resources for parallel query execution.; 42000"
The dimension I have been testing has 34 attributes, all directly related to the key attribute, and no hierarchies. There are 246,000 unique members in the source table. If I make another dimension from the same source table, it refreshes fine as long as there are only a few attributes, but when I add the rest, I get this message again.

Drive C, where Visual Studio is installed, has 69 Gb free disk space. The SQL and SSAS data are on D also has 69 Gb free.

Why was SQL 2005 able to handle this, but SQL 2008 cannot? I am thinking of uninstalling 2008 and going back to SQL 2005. Other suggestions?





start stop exe on a particuler machine based on ip address


I am makiing a web application and this application will run only in LAN enviorement.what i want to do is-

there is a textbox and a button start. in this textbox i want to give IP address and on button click i want to run a exe on the particluer system ( ip given). and on stop click i want to stop the exe.

stop page refreshing when the image button clicked


hi friends,

      I am struggling on stop page refreshing when the image button is clicked.How i can i achieve this?I used triggers,javascript,........

             Thanks in advance.

Start Workflow from ribbon button


I am running sharepoint 2010. I am currently building some stuff in it. I have a ribbon button in the list item ribbon that starts a workflow. 

when you click it, it brings up the "workflow initialization form". (Click start to start the workflow)

but there is no data to be entered. and its not like the worflow launches all the nukes pointed at Russia so I don't really need this level of confirmation.

is there a way to stop the form from displaying?

stop postback for asp button on clientclick


i am having a weird problem with javascript and the server postback.... if anyone possible please help me out ....

the aspx page :

<asp:Button ID="Submitbtn" runat="server" OnClick="ServerBtn_Click" OnClientClick="return javascript:btnGo_onClick();"
 Text="Submit" /> 

The Javascript :

function btnGo_onClick()

                      if(navigator.appName !='Microsoft Internet Explorer')
                            return false;
                      locator = new ActiveXObject("WbemScripting.SWbemLocator");
                      alert('Error ');
                      return false ;


The Server Side C# code 

protected void ServerBtn_Click(object sender, EventArgs e)

        Info Keyinfo = GetClientInfo();
        MemoryStream memorystream = new MemoryStream();
        XmlSerializer xs = new XmlSerializer(typeof(ClientInfo));
        XmlTextWriter xmlTextWriter = new XmlTextWrite

Button control to stop Javascript Function on slideshow


Hi everyone-

I've got this slideshow I've pieced together that fades in and fades out.  However, when pushing the Stop Button (same as the Play button) to stop on a slide, the Javascript function continues and fades out so it stops on a blank .  How can I alter this javascript function to only fade in, stop on the slide and not fade out when the stop button is pushed?

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SlideShow7.aspx.vb" Inherits="SlideShow7" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <style type="text/css">
            margin: 50px 0px;
            padding: 0px;
            text-align: center;
            width: 475px;
            margin: 0px auto;
            text-align: center;
            padding: 20px;
            border: 1px dashed gray;
            background-color: Silver;

Unable to enum ManagedComputer.Services & Stop/Start SQL Agent service from ASP.NET app

Hi guys

I have some code that stops/starts the SQL Server Agent service from within our ASP.NET web application.  Runs fine in development but doesn't in release - I suspect due to rights: Dev has admin rights, whereas Prod is running under a IIS application pool identity which is a domain account (e.g. IUSR_WEBAPP).

In Production it doesn't return any ManagedComputer.Services - ManagedComputer.Services.Count = 0. It doesn't throw any exceptions or anything, just not return any services or allow me to access the specific SQL Agent instance that I want to.

I've tried granting access in various places including WMI but nothing seems to work.  I cannot figure out what rights might be needed.

How can I grant access to my application pool account so that it can enumerate services and stop/start my specific SQL Agent account instance for 2005/2008?

Many thanks

Start MOSS AssetPicker Dialog over different button



I've got the following problem. I am using an thirdparty ascx file which includes several controls, fields and a asp:button too, which I can edit. I want to have the behaviour that the browse button of the LinkManager of MOSS is starting if I click this button.

So I want to have:

A button that starts the functionality of the browse button of the Link Manager. If you want to insert a Link in a RichHtmlField there is a dialog with a browse button. You can search in several sites, libraries and so on. I want to have this functionality of this button on another button.

The best way would be if I am able to call the function.

Another solution could be to set the Control of this function. I already found it:

<CMS:AssetUrlSelector id="assetSelectedUrl" CssTextBox="ms-input ms-assethyperlinkdialog-longtextbox" MaxLength=

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend