---
title: "Threads"  
description: "Threads"  
author: "Jaya J"  
published: 2015-03-25  
updated: 2015-03-30  
canonical: https://www.mindstick.com/forum/23053/threads  
category: ".net"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Threads

I have [Login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) [window](https://www.mindstick.com/forum/161285/how-does-the-window-console-object-work-in-javascript) as MainWindow of WPFApplication using c#.When i [Click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) on Login [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) it [opens](https://www.mindstick.com/news/2570/china-s-new-space-station-opens-for-business-in-an-increasingly-competitive-era-of-space-activity) another Window [named](https://answers.mindstick.com/qa/44918/what-is-a-no-day-yet-named-motion) [Student](https://www.mindstick.com/articles/157138/student-loan-default-wage-garnishment-and-student-loan).Now i want to close LoginWindow because when i'm working with Student Window there is no need of LoginWindow.\
How can i close LoginWindow using Threads.Is it possible?.If possible [Please tell me](https://www.mindstick.com/forum/33900/please-tell-me-what-are-the-technique-to-content-optimization) the code for this [Problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic)

## Replies

### Reply by Anonymous User

Try this code:

```
public void RanToCompletion(Task task)    {        if(_frmProgress.Dispatcher.CheckAccess())           
_frmProgress.Close();        else           
_frmProgress.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(_frmProgress.Close));    }
```


---

Original Source: https://www.mindstick.com/forum/23053/threads

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
