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


Top 5 Contributors of the Month
david stephan
Asad Ali
Fauzul Azmi
Post New Web Links

Open dialogue box in background worker

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :Windows Application
 
Hi, I am getting an error trying to open a dialogue box in background worker. Please help.   Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.IO Public Class Form1 Inherits Form Private folderBrowserDialog1 As FolderBrowserDialog Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click bgw.RunWorkerAsync() End Sub Private Sub BGW_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgw.DoWork Dim result As DialogResult = folderBrowserDialog1.ShowDialog() End Sub End Class


View Complete Post


More Related Resource Links

Background worker - errors in completed event

  
Create a new windows forms project (in using vb.net 2010). Create a button and a background worker on the form. Under the Debug > Exceptions menu, make sure that for 'Common Language Runtime Exceptions' you have 'Thrown' unticked and 'User-unhandled' ticked. Now put the following code in the form's code-behind; Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Threading.Thread.Sleep(2000) End Sub Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted Dim X As Integer X = 5 / X End Sub End Class Why does it not error nicely? It comes up with no helpful stack trace and just says 'Exception has been thrown by the target of an invocation.'. Place the code to cause the error into the Button_Click event and run it and you will see the difference. Why do we not get these 'nice' errors given that the runworkercompleted event is supposed to be running on the main thread?

Help with using a Background worker

  
Hi I am trying to use a background worker in my application.  I basically have a list of items displayed. When a user selects a particular item I have the background worker query the database to get information about the item selected and display it once it is done. (There are quite a few database calls) Since the database queries might take time, I have a UI wait animation displayed while the data is getting fetched. Once the background worker is completed I get rid of the wait animation and display the information fetched. This setup works fine if I do not click on any other item while the UI wait animation is being displayed. My main aim is to cancel the background worker from fetching the previously selected items information when a new item is selected (as the previous information would anyways be overwritten with the new item's information). The problem with such an approach is within the background worker's doWork method i would need to continuously check after each database query if the cancellation is pending and if it is then I can cancel the rest of the queries. I somehow feel this is not the right approach. If anyone has any suggestions about a better way to achieve the required functionality it would be great.. 

Error on datafilling in DataTable on background worker

  
I have got some error while datafilling from DataTable to Datagridview on BackgroundWorker... I saw some where that "Should not fill datatable while its working in Backgroundworker"... How can I manage this situation? Is there any possible logic to do that? Help me Sir,

WPF 4 with SSRS Report Viewer and long running Background Worker Dispatch task.

  

Hello,

I've recently run into an issue with with WPF 4 and the SSRS viewer control with a batch emailing application. See http://www.jenasysdesign.com.au/dnn/Blogs/tabid/71/EntryId/5/WPF-4-SQL-Server-Reporting-Services-processing-application-Memory-Leak.aspx for details of some performance profiling issues I found with this technology stack.

I've got two issues.

Firstly, I implemented a background worker process to handling looping through the 2,800 reports. I found to run the SSRS report viewer to export the report results in a slow memory leak. See Red-gate Ants memory profiler 6 image in the link above. I'm not sure what I need to do to remove weak references with this combination of technology. Any ideas?

Secondly, the following code runs on the background worker process, designed so the user can monitor the progress of the a large batch of report files getting generated.  The catch here is involves using the SSRS viewer to export a reports results requires the Dispatcher.Invoke method to ensure that ReportViewer.xaml screen gets a UI thread, but in the process it interferes with the background workers report progress methods, so the UI doesn't see the progress.  

WPF 4 with SSRS Report Viewer and long running Background Worker Dispatch task.

  

Hello,

I've recently run into an issue with with WPF 4 and the SSRS viewer control with a batch emailing application. See http://www.jenasysdesign.com.au/dnn/Blogs/tabid/71/EntryId/5/WPF-4-SQL-Server-Reporting-Services-processing-application-Memory-Leak.aspx for details of some performance profiling issues I found with this technology stack.

I've got two issues.

Firstly, I implemented a background worker process to handling looping through the 2,800 reports. I found to run the SSRS report viewer to export the report results in a slow memory leak. See Red-gate Ants memory profiler 6 image in the link above. I'm not sure what I need to do to remove weak references with this combination of technology. Any ideas?

Secondly, the following code runs on the background worker process, designed so the user can monitor the progress of the a large batch of report files getting generated.  The catch here is involves using the SSRS viewer to export a reports results requires the Dispatcher.Invoke method to ensure that ReportViewer.xaml screen gets a UI thread, but in the process it interferes with the background workers report progress methods, so the UI doesn't see the progress.  

Should Lotus Notes Client be running or Open in background to send emails programatically using .NET

  

Hi

Does Lotus notes client be running or opened in the background to send emails using Lotus Notes with .Net?

    I am working on a task where my app should send emails using Lotus Notes with .NET . I am able to send mails also. But the problem comes when i close my Lotus Notes mail and try to run my application which sends mails. But the mails are not being delivered. Reason, they were being stored in "Outgoing mail". Again when i open my Lotus Notes client by entering my username and password, then the mails that were in "Outgoing mail" were been delivered. Should lotus notes client run on the background for my application to send emails? Is there any way that my application sends emails even if lotus notes is not opened? I'm struck with this issue all day, did lot of research, but i could find anything.

i used this link  as a base ref to send emails using .net http://www.ibm.com/developerworks/lotus/library/domino-msnet/  

Any help regarding this is greatly appreciated.


A query regarding the MSDN library background worker example

  

In the MSDN library article "How to: Use a Background Worker",

(see http://msdn.microsoft.com/en-us/library/cc221403(VS.95).aspx),

the following sample code is presented...


Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
    Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)

    For i = 1 To 10
        If bw.CancellationPending = True Then
            e.Cancel = True
            Exit For
        Else
            ' Perform a time consuming operation and report progress.
            System.Threading.Thread.Sleep(500)
            bw.ReportProgress(i * 10)
        End If
    Next
End Sub

For what purpose has the "Dim worker as..." statement been included in this code?

Siggy


How to pause resume Background Worker Thread?

  

We are working on a VB.Net window based application and we are using Visual Studio 2010 Professional.

In our application during the execution process we have used Background Worker thread and user have the option of cancelling the execution only.

Now we came across a situation that if user wants to pause the execution process then how we can pause the background worker thread so that it can be resumed on resuming the execution by the user?

 

Regards,

Premjeet Singh


Regards, Premjeet Singh

How To Open Fancy Tooltip from GridView

  
This article will show How To Open show Fancy Tooltip in GridView.

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

  
"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

Alternating row background for first column of a report

  

is there a way to make the first column of a report use the an alternating background color? 

I have the background color set for the entire row however it does not work for the first column if the color is set to an expression.  If I just set it to a color i.e. red it works just fine. If I insert a dummy column to the left it works just fine (but the dummy column does not work, presumably because it is first??).

In the file below only the textbox for part number does not show an alternating background.  All others work correctly.

<TableRows>
            <TableRow>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="PartNumber">
                      <rd:DefaultName>PartNumber</rd:DefaultName>
 

Open ModalPopup dialog on page load

  

Is there a way to make a modal popup panel active on page load so that the user can't do anything until they deal with the popup dialog?


Selected to change the background color of the page

  

Hi,

As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.


Open PopUp Window From Error httpModule

  

I would like to open a popup window from the assembly to present the information to the user. Does anyone know if this is possible, I am presently doing the following:

HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
WriteLine("<HTML>")
        WriteLine("<HEAD>")
        WriteLine("<TITLE>")
        WriteLine(FormatDisplayString(strPageTitle))
        WriteLine("</TITLE>")
        WriteLine("<STYLE>")
        WriteLine("body {font-family:""Verdana"";font-weight:normal;font-size: .7em;color:black; background-color:white;}")
        WriteLine("b {font-family:""Verdana"";font-weight:bold;color:black;margin-top: -5px}")
        WriteLine("H1 { font-family:""Verdana"";font-weight:normal;font-size:18pt;color:red }")
        WriteLine("H2 { font-family:""Verdana"";font-weight:normal;font-size:14pt;color:maroon }")
        WriteLine("pre {font-family:""Lucida Console"";font-size: .9em}")
        WriteLine("</STYLE>")
        WriteLine("</HEAD>")
        WriteLine("<BODY>")
        WriteLine("<H1>")
        WriteLine(FormatDi

how to make a css style background image be linked to an image in the resource file

  

hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.


thanks in advance


Microsoft Office Excel cannot open or save any more documents because there is not enough available

  

hi all,

     i am new to asp.net programming i am trying to create an ms excel file with charts drawn in it,

i wrote the complete code for it but the it is saying

Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. 

i have set the permissions to my complete disk space and all user accounts, and i tried with anti-virus disabling also it didnt work please try to help me out and my code is :

Imports System.Data.OleDb
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Tools.Excel
Imports System

Merge SQL to Excel--Need .Net button to open on fly and have current SQL data!

  

           Hello all,
I do not know if this is the proper place to ask this, but my question is...
I have a SQL DB and I want to convert it to Excel Sheet (I did this using the wizard)!
In my aspx page I have a button.  So when I press this button I want the Excel sheet to open!  But I need the Excel sheet to show me the up to date information that is in the SQL DB.  
Categories: 
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