|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace McKechney.EmbeddedResouceTextExample
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class ExampleForm : System.Windows.Forms.Form
{
private System.Windows.Forms.RichTextBox rtbResults;
private System.Windows.Forms.Button btnGetQuote;
private System.Windows.Forms.Button btnGetSQL;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public ExampleForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.rtbResults = new System.Windows.Forms.RichTextBox();
this.btnGetQuote = new System.Windows.Forms.Button();
this.btnGetSQL = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// rtbResults
//
this.rtbResults.Location = new System.Drawing.Point(24, 72);
this.rtbResults.Name = "rtbResults";
this.rtbResults.Size = new System.Drawing.Size(440, 312);
this.rtbResults.TabIndex = 0;
this.rtbResults.Text = "";
//
// btnGetQuote
//
this.btnGetQuote.Location = new System.Drawing.Point(24, 24);
this.btnGetQuote.Name = "btnGetQuote";
this.btnGetQuote.TabIndex = 1;
this.btnGetQuote.Text = "Get Quote";
this.btnGetQuote.Click += new System.EventHandler(this.btnGetQuote_Click);
//
// btnGetSQL
//
this.btnGetSQL.Location = new System.Drawing.Point(128, 24);
this.btnGetSQL.Name = "btnGetSQL";
this.btnGetSQL.TabIndex = 2;
this.btnGetSQL.Text = "Get SQL";
this.btnGetSQL.Click += new System.EventHandler(this.btnGetSQL_Click);
//
// ExampleForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(504, 406);
this.Controls.Add(this.btnGetSQL);
this.Controls.Add(this.btnGetQuote);
this.Controls.Add(this.rtbResults);
this.Name = "ExampleForm";
this.Text = "Embedded Resource Text Eample";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new ExampleForm());
}
private void btnGetQuote_Click(object sender, System.EventArgs e)
{
string quote = new EmbeddedResourceTextReader().GetFromResources("McKechney.EmbeddedResouceTextExample.Folder.Shakespeare.txt");
this.rtbResults.Text = quote;
}
private void btnGetSQL_Click(object sender, System.EventArgs e)
{
string sql = new EmbeddedResourceTextReader().GetFromResources("McKechney.EmbeddedResouceTextExample.CreateTable.sql");
this.rtbResults.Text = sql;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.