drag and drop - C# - Calling a string from a different method? -
drag and drop - C# - Calling a string from a different method? -
i know easy...but attempting first application in c# (and excited it!).
i figured, on drop, file path , create string, phone call string 1 time button click. ideas, references, other pages, or info gladly appreciated!
though nominal...this have far button , dragdrop:
private void b1_click(object sender, eventargs e) { process.start(???); } private void b1_dragdrop(object sender, drageventargs e) { string[] b1file = (string[])e.data.getdata(dataformats.filedrop, false); } my goal create programme user can drag , drop file want button. 1 time dropped, file name paste button face (this.b1.text) , icon paste picturebox floats on button. 1 time button clicked, file path dropped file opens.
you can create variable private in class , utilize it. note: b1_dragdrop should run before b1_click
private string[] b1file; private void b1_click(object sender, eventargs e) { foreach (var item in b1file) { process.start(item); } } private void b1_dragdrop(object sender, drageventargs e) { b1file = (string[])e.data.getdata(dataformats.filedrop, false); } c# drag-and-drop process.start
Comments
Post a Comment