SIMIN Posted October 6, 2008 Posted October 6, 2008 Hello friends, I have 3 questions about ComboBox, anyone can help me, please? :) 1. Although I have enabled AllowDrop property of ComboBox it does not allow me to drag and drop files into ComboBox. Why? 2. Then should I process incoming files in the _DragDrop event, yes? 3. How can I get the Files.Count to get the number of dropped files? Thank you very much for helping me :) Quote
Administrators PlausiblyDamp Posted October 6, 2008 Administrators Posted October 6, 2008 private void comboBox1_DragDrop(object sender, DragEventArgs e) { string[] names = (string[]) e.Data.GetData(DataFormats.FileDrop); comboBox1.Items.AddRange(names); } private void comboBox1_DragEnter(object sender, DragEventArgs e) { if(e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } Should give you the basic idea, the key is to handle the DragEnter and state what effect should be displayed, if this step is missed then the drop event will never be fired. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.