Thanks a Lot Bob.
It worked well.
-SARADHI
"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message news:Ot******** ******@TK2MSFTN GP11.phx.gbl...
If it's a resources file, load it with ResourceReader and use GetEnumerator to return an IDictionaryEnum erator. If the resources are in a satellite assembly load them with a ResourceManager and get the resource set required. You must know the culture that you're searching for.
After my signature a simple application demonstrates using a resourcereader.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
using System;
using System.Resource s;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
namespace resourceenumera tor
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Button button1;
private System.Windows. Forms.Button button2;
private System.Windows. Forms.TextBox textBox1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();
//
// TODO: Add any constructor code after InitializeCompo nent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
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 InitializeCompo nent()
{
this.button1 = new System.Windows. Forms.Button();
this.button2 = new System.Windows. Forms.Button();
this.textBox1 = new System.Windows. Forms.TextBox() ;
this.SuspendLay out();
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(208, 200);
this.button1.Na me = "button1";
this.button1.Ta bIndex = 0;
this.button1.Te xt = "Open";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// button2
//
this.button2.Lo cation = new System.Drawing. Point(208, 232);
this.button2.Na me = "button2";
this.button2.Ta bIndex = 1;
this.button2.Te xt = "Quit";
this.button2.Cl ick += new System.EventHan dler(this.butto n2_Click);
//
// textBox1
//
this.textBox1.L ocation = new System.Drawing. Point(8, 8);
this.textBox1.M ultiline = true;
this.textBox1.N ame = "textBox1";
this.textBox1.S ize = new System.Drawing. Size(272, 184);
this.textBox1.T abIndex = 2;
this.textBox1.T ext = "";
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(292, 266);
this.Controls.A dd(this.textBox 1);
this.Controls.A dd(this.button2 );
this.Controls.A dd(this.button1 );
this.FormBorder Style = System.Windows. Forms.FormBorde rStyle.FixedDia log;
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayo ut(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}
private void button1_Click(o bject sender, System.EventArg s e)
{
OpenFileDialog dlg=new OpenFileDialog( );
dlg.Filter="Res ource files|*.resourc es";
if(dlg.ShowDial og()==DialogRes ult.OK)
{
ResourceReader rr=new ResourceReader( dlg.FileName);
IDictionaryEnum erator en = rr.GetEnumerato r();
while(en.MoveNe xt())
this.textBox1.T ext+=en.Key+"\r \n";
}
}
private void button2_Click(o bject sender, System.EventArg s e)
{
Application.Exi t();
}
}
}
"Saradhi" <up*******@inoo ga.com> wrote in message news:eC******** ******@TK2MSFTN GP15.phx.gbl...
How to get the names of all the Resources embedded in a Resource File?
-SARADHI