O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.6. The List Box for Unformatted Output

Up to this point we have been directing our text to a console window. A somewhat more visually appealing alternative is to direct our output to the list box of a Windows Forms window. For example, Figure 6.12 displays the content of a text file directed into a simple form containing only a list box. As configured, the vertical and horizontal scrolling is added as needed. The program is virtually unchanged, although factored out into an independent function:

Figure 6.12. The Windows Forms List Box Window

 private void process_file( string file_name ) { StreamReader ifile = File.OpenText( file_name ); string ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required