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

  • SEARCH
  • Home
  • 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 6135651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:30:18+00:00 2026-05-23T17:30:18+00:00

I have a checkedlistbox and I want to drag and drop only image extensions

  • 0

I have a checkedlistbox and I want to drag and drop only image extensions and not text files.
so how do I get it done.
I am able to drag and drop all file formats but I need only image files.
Here is my code:

Private Sub CheckedListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles CheckedListBox1.DragDrop

    Dim Files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
    For Each FileName As String In Files
        CheckedListBox1.Items.Add(FileName, CheckState.Checked)
        Thumbcontrol1.AddThumbnail(FileName)
    Next
End Sub

Private Sub CheckedListBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles CheckedListBox1.DragEnter
    If e.Data.GetDataPresent(DataFormats.FileDrop) Then
        e.Effect = DragDropEffects.Copy
    End If
End Sub
  • 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-05-23T17:30:19+00:00Added an answer on May 23, 2026 at 5:30 pm

    Just check each file name’s extension.

    Private Shared ReadOnly SupportedExtensions As String() = {".jpg", ".jpeg", ".gif"}
    
    Private Sub CheckedListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles CheckedListBox1.DragDrop
        Dim Files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
        For Each FileName As String In Files
            Dim Extension As String = Path.GetExtension(FileName).ToLower
            If Array.IndexOf(SupportedExtensions, Extension) <> -1 Then
                CheckedListBox1.Items.Add(FileName, CheckState.Checked)
                Thumbcontrol1.AddThumbnail(FileName)
            End If
        Next
    End Sub
    

    You may want to add similar code to the DragEnter method to show DragDropEffects.None if there are no picture files in the dragged file list.

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

Sidebar

Related Questions

I have CheckedListBox, now i want to put image from the ImageList next to
I have a form containing a checkedlistbox, I want to be able to do
I have done some search in Google but not able to find a useful
I have a CheckedListBox previously populated. I want to loop with a for each
I have a checkedlistbox and when i populate it i want to have an
I have a CheckedListBox. I would like to be able to select items when
In my CheckedListBox app I want to allow only a single item to be
I have a MultiBinding that is not working on TextBox.Text. I have the same
My requirement is, i have a checkedlistbox, and i want the selected item should
I have a CheckedListBox, and I want to automatically tick one of the items

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.