Ok, this is a strange one.... I have a listbox in my main form that I allow files to be added to with a button or via drag/drop method. Later in the program, based on some information in the form, I start another process (cmd.exe) to enter some information into the registry. If I add items to the list with the add button everything works fine. If I add items with drag and drop the process starts but thats it, it just hangs there; no expcetion or error.
Here is the drag/drop events.
Drag/Drop Enter:
Drag/Drop Drop:Code:private void DD_Enter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.All; } else { e.Effect = DragDropEffects.None; } }
Here is the Process start information.Code:private void DD_Drop(object sender, DragEventArgs e) { string[] DDFiles = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string FileExt in DDFiles) { if (!FileExt.ToLower().EndsWith(".mtmtdb")) { MessageBox.Show("Only ModernTech Training Database Files (.mtmtdb) Can Be Utilitzed"); } else { if (!DatabaseList.Items.Contains(FileExt)) { DatabaseList.Items.Add(FileExt); } else { MessageBox.Show("Database Item Already Present"); } } } }
If I add via the add button and run the application than every messagebox will show. If I do it via drag/drop on the "Process Start" box shows. That is the only difference between the two when I run it...Code:try { System.Diagnostics.Process ImportRegistry = new System.Diagnostics.Process(); ImportRegistry.StartInfo.FileName = "cmd.exe"; ImportRegistry.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; ImportRegistry.StartInfo.Arguments = ("/C regedit.exe /s " + @"""" + RFLocation + @""""); MessageBox.Show("Process Start"); ImportRegistry.Start(); MessageBox.Show("Process Started/Stop"); ImportRegistry.Close(); MessageBox.Show("Process Stopped"); } catch (Exception ex0) { MessageBox.Show(ex0.ToString()); }
Help!!! Please!![]()


Reply With Quote