Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:10:01+00:00 2026-06-15T19:10:01+00:00

I am trying to drop a file from windows explorer to my form and

  • 0

I am trying to drop a file from windows explorer to my form and I am almost successful 🙂
After opening explorer window in shell I can drop a file to my form where I have one message box/dialog before accepting.

Problem is in fact that my messagebox with question opens in back of explorer window.
Here is a code:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.AllowDrop = True
End Sub

Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
    If e.Data.GetDataPresent(DataFormats.FileDrop) Then
        Dim Files() As String
        Files = e.Data.GetData(DataFormats.FileDrop)
        If Files.Length > 0 Then
            Dim ret As Integer = MsgBox("Would you like to upload file?" & vbNewLine & Files(0), MsgBoxStyle.OkCancel + MsgBoxStyle.Question, "Decide please")
            If ret = DialogResult.OK Then
                myModule.UploadF()
            End If
        End If
    End If
End Sub

Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
    If e.Data.GetDataPresent(DataFormats.FileDrop) Then
        e.Effect = DragDropEffects.All
    Else
        e.Effect = DragDropEffects.None
    End If
End Sub

Private Sub btn_open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_open.Click
    Shell("explorer c:\", AppWinStyle.NormalFocus)
End Sub

End Class

1) Is here any way to get messagebox to pop in front of explorer window?
2) How to close opened explorer window from my program after usage?

EDIT: Solution for…
1) is to place Me.Activate before MsgBox!
2) for that I still don’t find a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:10:03+00:00Added an answer on June 15, 2026 at 7:10 pm

    Try this:

    Add a Dialog to your project. (Found in the list of addable things like form, class etc).
    Add a label to it and change the text in the constructor.
    In the Dialogs paint event add this:

    Me.BringToFront()
    

    Then use this dialog instead of MsgBox, it should provide what you need.

    It’s somewhat of a workaround but it should work.

    Edit:

    Right, found a better solution.

    Add this to the code written in this question before calling MsgBox:

    Me.BringToFront()
    Me.TopMost = True
    

    And you will be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to drop a SQL Server database from .NET code. I've tried using
Im a newbie ih php.Im trying to show drop down list values from database
Trying to programmatically add options to a SELECT drop down in IE Windows Mobile.
I am trying out some Drag Drop functionalities and can't discern the difference between
I started trying to implement drag-and-drop of virtual files (from a C# 4/WPF app)
I am trying to upload big files with drag and drop. I have this
I'm trying to implement jQuery-File-Upload - I have it working when I drag &
I'm currently trying to get the path of a file from a drag and
I'm trying to print a query result to file from MySQL ( SELECT blah
I have been trying to run a mySQL query that populates a HTML form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.