473,785 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Thr eadException mysteriously solve a problem...

Hello,
in a VB.NET Application I had a problem after a Drag&Drop operation from
Windows Desktop (Dataformats.fi ledrop) to listview....
In debug there are no errors so I've decided to implement the application
ThreadException event (throug addhandler in sub main)
After this the problem was disappeared...
Why?

Thank You
Jul 21 '05 #1
3 1528
What was the problem? Are you using System.Windows. Forms.Clipboard together
with multiple threads?

Regards, Jakob.
"Giovanni pepe" wrote:
Hello,
in a VB.NET Application I had a problem after a Drag&Drop operation from
Windows Desktop (Dataformats.fi ledrop) to listview....
In debug there are no errors so I've decided to implement the application
ThreadException event (throug addhandler in sub main)
After this the problem was disappeared...
Why?

Thank You

Jul 21 '05 #2
This is my code for Drag&Drop :

Lvw_DragDrop:
--------------------------------------------------------------------------
For Each Filename In e.Data.GetData( DataFormats.Fil eDrop)
ReDim Preserve SourceFiles(i)
SourceFiles(i) = CompleteFilenam e
i = i + 1
Next
--------------------------------------------------------------------------

Lvw_DragEnter:
------------------------------------------------------------------------
If (e.Data.GetData Present(DataFor mats.FileDrop, False)) Then
e.Effect = DragDropEffects .Copy
End If
------------------------------------------------------------------------

This code generate an error ...
The error is disappear when i insert into code Application.Thr eadException
Jul 21 '05 #3
I tried the following code which is very similar to yours and it works fine:

Private Sub ListView1_DragD rop(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles ListView1.DragD rop
Dim Filename As String
For Each Filename In e.Data.GetData( DataFormats.Fil eDrop)
Dim item As New ListViewItem
item.Text = Filename
ListView1.Items .Add(item)

Next
End Sub

Private Sub ListView1_DragE nter(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles ListView1.DragE nter
If (e.Data.GetData Present(DataFor mats.FileDrop, False)) Then
e.Effect = DragDropEffects .Copy
End If
End Sub

Are you sure that you are not using threads somewhere? Is your form running
on the main thread of your application? Are you using the MTAThreadAttrib ute
anywhere? Which error is generated by your code?

Regards, Jakob.
"Giovanni pepe" wrote:
This is my code for Drag&Drop :

Lvw_DragDrop:
--------------------------------------------------------------------------
For Each Filename In e.Data.GetData( DataFormats.Fil eDrop)
ReDim Preserve SourceFiles(i)
SourceFiles(i) = CompleteFilenam e
i = i + 1
Next
--------------------------------------------------------------------------

Lvw_DragEnter:
------------------------------------------------------------------------
If (e.Data.GetData Present(DataFor mats.FileDrop, False)) Then
e.Effect = DragDropEffects .Copy
End If
------------------------------------------------------------------------

This code generate an error ...
The error is disappear when i insert into code Application.Thr eadException

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
16975
by: Bill | last post by:
For some reason, I have an errormessage popup that "blinks", but pops up BEHIND the applications, which is confusing to users. Is there any way to force it to the top?
2
1348
by: Mathieu Brüning | last post by:
Hi all, i'm trying to write an exception handler for my application, so in case an exception occurs anywhere in my application, the exception has to be catched. At this moment i'm doing it via the following code: Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
5
1531
by: Jason MacKenzie | last post by:
I have a production critical windows forms application. I have try catch blocks everywhere to handle every eventuality. However occasionally, every couple of months, the application crashes. Its usually a .Net Framework error message telling me there was an unhandled exception An example would be last October when the clocks rolled back. My question is: is there a way to handle an exceptions that might make it through the error...
2
4775
by: Alex | last post by:
My Problem is that although i have added a handler to Application.ThreadException and it works fine for my application exceptions, it does not fire if an exception is generated inside an event handler of my App. eg. If i throw a exception inside DragDrop, or MouseDown of an event the ThreadException does not fire !! Any ideas ???
4
10770
by: rs | last post by:
Hi guys Thank you in advance for the help. I developed a simple application using vs.net 2003. running framework 1.1 sp1. the application runs fine on the development machine (win xp). I tried to deploy it on a win 2000 sp4 framework 1.1 sp1. I got the following error Reminder.exe - Common Language Runtime Debugging Services application has generated an exception that could not be handled
3
233
by: Giovanni pepe | last post by:
Hello, in a VB.NET Application I had a problem after a Drag&Drop operation from Windows Desktop (Dataformats.filedrop) to listview.... In debug there are no errors so I've decided to implement the application ThreadException event (throug addhandler in sub main) After this the problem was disappeared... Why? Thank You
6
1234
by: TPI | last post by:
I wrote application wich i working on IntPtr. Whole thing is using Marshal.ReadInt32 and Marshal.WriteInt32. And sometimes the application shuts down with out any wornings and exceptions. With out worninigs and exceptions I do not know where to look up. I need help with this problem.
7
2598
by: Daniel | last post by:
Hello! I am having a problem with a windows application that abnormally terminates itself. The application is a multi threaded .NET 1.1 application, and can briefly be described as follows: Call the thread running the GUI "A". When user clicks a button a new thread "B" is created and started. "B" does a lots of work, among others transmitts data via a USB-CAN-interface. At the end of "B" a paper label is printed using methods provided...
5
4539
by: Frank Rizzo | last post by:
I have a c# 2.0 winform app that runs under a user account with very limited rights. The application crashes on some actions (the Send Error to Microsoft screen) with unauthorized exception. This is despite the fact that I have try catch blocks around pretty much absolutely everything. I've tried logging to disk, but it seems to crash on a deeper level. The app works fine when run under an admin account. So how can I audit what the...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.