Silverlight reading files
To display the dialog, we use ShowDialog method. If it returns a false, which means nothing was selected, we do nothing. If a file was selected, we create a StreamReader for it and read its contents into a string variable. Then we display the contents of this variable in the text box. To test the application, I copied the entire text of Page. Upon building and executing the application, the following output was shown after I selected Code. Figure 1.
As the text box displays scrollbars, you can scroll down. After scrolling further, more code was shown as seen below:. Figure 2. Conclusion: In this article, you explored how to select and open a text file and display its contents in a TextBox using OpenFileDialog in Silverlight.
View All. Mamta M Updated date Feb 05, Introduction : Silverlight 2 provides you with the OpenFileDialog API using which you can open files of specific types such as, image files, text files and so forth. Generic; using System. Linq; using System.
Net; using System. Search icon An illustration of a magnifying glass. User icon An illustration of a person's head and chest. Sign up Log in. Web icon An illustration of a computer application window Wayback Machine Texts icon An illustration of an open book. Books Video icon An illustration of two cells of a film strip. Video Audio icon An illustration of an audio speaker. Audio Software icon An illustration of a 3. Software Images icon An illustration of two photographs.
Images Donate icon An illustration of a heart shape Donate Ellipses icon An illustration of text ellipses. Connect and share knowledge within a single location that is structured and easy to search. However it does not work, it gives an error "Only assignment, calls, increment, decrement You cannot read web. Like this you have your app settings in the Silverlight application on the client.
You can't read web. NET Framework, but what you can do is this:. Configure Silverlight 3 Applications using the Web. The edited or next version of the above article is published and this need to be followed for web. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 10 years, 8 months ago.
Active 7 years, 2 months ago. Viewed 17k times.
0コメント