473,385 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Application.ThreadException mysteriously solve a problem...

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
Jul 21 '05 #1
3 1478
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.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

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

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

Lvw_DragEnter:
------------------------------------------------------------------------
If (e.Data.GetDataPresent(DataFormats.FileDrop, False)) Then
e.Effect = DragDropEffects.Copy
End If
------------------------------------------------------------------------

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

Private Sub ListView1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop
Dim Filename As String
For Each Filename In e.Data.GetData(DataFormats.FileDrop)
Dim item As New ListViewItem
item.Text = Filename
ListView1.Items.Add(item)

Next
End Sub

Private Sub ListView1_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles ListView1.DragEnter
If (e.Data.GetDataPresent(DataFormats.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 MTAThreadAttribute
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.FileDrop)
ReDim Preserve SourceFiles(i)
SourceFiles(i) = CompleteFilename
i = i + 1
Next
--------------------------------------------------------------------------

Lvw_DragEnter:
------------------------------------------------------------------------
If (e.Data.GetDataPresent(DataFormats.FileDrop, False)) Then
e.Effect = DragDropEffects.Copy
End If
------------------------------------------------------------------------

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

Jul 21 '05 #4

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

Similar topics

7
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
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...
5
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...
2
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...
4
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...
3
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...
6
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...
7
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: ...
5
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.