Discussion:
WinAPI::getOpenFileName with Multiselect
(too old to reply)
Werner
2010-01-21 09:51:02 UTC
Permalink
Has anyone tried to use this Methode with the OFN_ALLOWMULTISELECT Flag?
The Dialog allow's the Multiselect, but the return value sFileName only
contain's the directory of the selected files.

best regards.
i***@gmail.com
2013-05-09 13:55:39 UTC
Permalink
I couldnt do anything with "OFN_ALLOWMULTISELECT" or "get_filenames()...
but I wrote the following code in ax 2009 and I get all the path of the selected items and it worked.I hope it is useful for you

System.Windows.Forms.OpenFileDialog ofd;
System.String[] s2;
int counters;
str imageValaue;
int i;
;
ofd = new System.Windows.Forms.OpenFileDialog();
ofd.set_Title("Resim");
ofd.set_Multiselect(true);
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult::OK)
{
s2 = ofd.get_FileNames();
counters=System.Convert::ToInt32( s2.get_Length());
for(i = 0 ; i <= counters-1; i++)
{
imageValaue = System.Convert::ToString(s2.GetValue(i));
//do whatever you want ;)
}
}

===============================================
but if you use ax 2012 try this

System.Windows.Forms.OpenFileDialog ofd;
System.String[] s2;
;
ofd = new System.Windows.Forms.OpenFileDialog();
ofd.set_Title("resim");
ofd.set_Multiselect(true);
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult::OK)
{
s2 = ofd.get_FileNames();
}
info( s2.get_Item(1) );
info( s2.get_Item(2) );
}
=========================================

Loading...