My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.


23 hours ago: How can a silverlight app download and play an mp3 file from a URL? #stackoverflow #question http://is.gd/aRxjK.
24 hours ago: Omg, google docs publishes their documents with embedded font tags: <FONT style=background-color:#ffff00>.
yesterday: Seen on the internet: "we produce hight quolity products".
yesterday: How to consume text from any Google Document, RSS feed, or Twitter feed in your Silverlight application: http://is.gd/aRjO2.
yesterday: WANTED: online service in which I can type some C# code, and it gives me equivalent code in PHP & other languages #googletranslateforcode.
2 days ago: Good article about workarounds for getting data into silverlight from sites that don't support clientaccesspolicy.xml: http://is.gd/aQrL5.
2 days ago: Saddened by the fact that I get a security error when trying to read a google doc URL with Silverlight, workarounds anyone?
2 days ago: When I step in to debug a certain method in my silverlight app, the music in my youtube playlist stops until I stop debugging #feature.
2 days ago: Love Generate Method Stub in Visual Studio, did I have that in Eclipse? I can't remember.
2 days ago: "RealNetworks has been blocked from communicating with your local computer and network", Allow? / No. Thanks Windows 7.
2 days ago: Somebody needs to fix the here's-20-pages-of-incomprehensible-legal-text-Accept? dysfunctional behavior we all engage in daily.
How to use a WPF FileDialog to read in a text file This example shows how you can allow the user to click on a button and choose a text file to view the contents of the file in a scrollable box on the screen. ![]() XAML:
<Window x:Class="TestFileDialog2343.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="350"> <StackPanel Margin="10" HorizontalAlignment="Left"> <StackPanel HorizontalAlignment="Left"> <Button Content="Load File" Click="Button_LoadFile_Click" Margin="0 0 0 10"/> </StackPanel> <ScrollViewer Width="300" Height="200"> <TextBox x:Name="TextFileContent" TextWrapping="Wrap"/> </ScrollViewer> </StackPanel> </Window> Code Behind:
using System.Windows; using Microsoft.Win32; using System.Text; using System.IO; using System; namespace TestFileDialog2343 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void Button_LoadFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".txt"; dlg.InitialDirectory = @"C:test"; dlg.Filter = "Text documents (.txt)|*.txt"; bool? result = dlg.ShowDialog(); if (result == true) { TextFileContent.Text =File.ReadAllText(dlg.FileName); } } } } |
Most Recently Added Items:
- How to consume text from any Google Document, RSS feed, or Twitter feed in your Silverlight application - wpf code example - added 22 hours ago
- How to overlay one image on top of another in code behind - wpf code example - added 2 days ago
- How to get the mouse-click and mouseover coordinates from an image - wpf code example - added 5 days ago
- How to use OrderedDictionary to lookup items by string key or integer index - c# code example - added 5 days ago
- How to use NameValueCollection for a collection of items with both single and multiple keys - c# code example - added on Sunday, March 07, 2010
- How to use TryGetValue with Dictionary to test and get value if exists in one statement - wpf code example - added on Saturday, March 06, 2010
- How to overload constructors with the "this" keyword - wpf code example - added on Thursday, March 04, 2010
- How to make a CSS layout for icon-left, text-right with floating divs - wpf code example - added on Sunday, February 28, 2010
- How to convert a tabbed outline text to a XAML TreeView - wpf code example - added on Thursday, February 25, 2010
- Extension method to remove preceding and succeeding blank lines on a List
- wpf code example - added on Thursday, February 25, 2010 - How to Create a TreeView with HierarchicalDataTemplate based on a collection of objects with collections - wpf code example - added on Wednesday, February 24, 2010
- How to check for first and last items in a foreach loop - c# code example - added on Monday, February 22, 2010
- How to format text in a WPF application (bold, italic, colored, hyperlinks, etc.) - wpf code example - added on Sunday, February 21, 2010
- Two ways to set focus in a programmatically created textbox - wpf code example - added on Sunday, February 14, 2010
- How to make a scrollable StackPanel that changes its content but keeps scroll position - wpf code example - added on Sunday, February 14, 2010
- Custom ChooserGroup control which allows user to change selection kind from dropdown to radiobuttons - wpf code example - added on Saturday, February 06, 2010
- Base code to create a simple regex unit tester - c# code example - added on Saturday, February 06, 2010
- How to use a WPF FileDialog to read in a text file - wpf code example - added on Saturday, February 06, 2010
- How to stop a XAML button from expanding to the size of its parent width - xaml code example - added on Saturday, February 06, 2010
- How to pass an event handler as a parameter - wpf code example - added on Tuesday, February 02, 2010
- How to make open/close flashcards with JQuery - jquery code example - added on Monday, February 01, 2010
- How to create a generic method to return a specific type specified by the call - c# code example - added on Saturday, January 30, 2010
- How to use brackets to define scope - wpf code example - added on Friday, January 29, 2010
- JQuery all-in-one template page for quick examples - jquery code example - added on Wednesday, January 27, 2010
- How to make StringBuilder have a .Clear() method - c# code example - added on Wednesday, January 27, 2010
- How to allow a user to click on TextBlocks which return an integer ID in the click handler - wpf code example - added on Wednesday, January 27, 2010
- Two ways to use the arguments object of a Javascript function as an array - javascript code example - added on Tuesday, January 19, 2010
- How to handle double-click in WPF when you don't need to handle single-click - wpf code example - added on Tuesday, January 19, 2010
- How to create JQuery-like chaining in C# with Extension methods - wpf code example - added on Sunday, January 17, 2010
- How to randomize the order of a List
collection - wpf code example - added on Sunday, January 17, 2010
