Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > FileDialogue.Choose() does not work

Forum

Search UsersRules
FileDialogue.Choose() does not work
#1
Interested
Points:: 0
Joined:: Nov 10, 2011

Hello!

I created an empty configuration and for command "import" I just took the code from another old application, and it does not work:

Code
Mode = FileDialogMode.Open;
   OpeningFileDialogue = New FileDialog(Mode);
   OpeningFileDialogue.FullFileName = "";
   Filter = "Excel(*.xlsx)|*.xlsx|Excel 97(*.xls)|*.xls";
   OpeningFileDialogue.Filter = Filter;
   OpeningFileDialogue.Multiselect = False;
   OpeningFileDialogue.Title = "Select file";
   If OpeningFileDialogue.Choose() Then
       FilesArray = OpeningFileDialogue.SelectedFiles;
       For Each FileName In FilesArray Do
           Selection = New File(FileName);
           //Message(FileName+"; Size = "+Selection.Size());
      EndDo;
      ImportAtServer(Selection.FullName);
      //UpdatePriceList();
   Else
       DoMessageBox("File(s) not selected!");
   EndIf;   
EndProcedure


In the line OpeningFileDialogue.Choose() I get an error:

{Catalog.CustomersSite.Form.ListForm.Form(16)}: Error calling context method (Choose)
If OpeningFileDialogue.Choose() Then
because:
Cannot call synchronous methods on the client!

What's wrong?

Thank you for every advice!

Profile
#2
Interested
Points:: 0
Joined:: Nov 10, 2011

Well, I figured it out! I needed to change properties of the configuration

Now it works!

Profile
#3
Guest
Points::
Joined::

Hello, Lioudmila!

If you are going to use Web client, you will need to disable modality usage and synchronous calls and use asynchronous functions.
In this case, you need to use the FileDialogMode.Show() method.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.