Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Utilities » Downloads
 
Add your own
alternative version

ResxWriter: Generating .resx files from an Excel spreadsheet

, 17 Nov 2006
Generate .resx files from an Excel spreadsheet; fully customizable.
resxwriter.zip
ResxWriter.msi
resxwriter_src.zip
ApplicationCleaner
ApplicationCleaner.csproj.user
Private Folder.ico
Setup
Setup.vdproj
UI
Images
BANNER with logo.png
BANNER.BMP
INTERNET.ICO
Key
key.snk
License
License.rtf
SampleData
sample.xls
UI.csproj.user
UninstallLauncher
uninstall.ICO
UninstallLauncher.csproj.user
/*
 * Patrick Bounaix
 * www.L0g1c4L.com
 * 
 * See AssemblyInfo.cs 
 * for License Information
 * */

#region using
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Globalization;
#endregion

namespace L0g1c4L.ResxWriter.UI
{
	/// <summary>
	/// Summary description for FrmAddColumn.
	/// </summary>
	public class FrmAddColumn : System.Windows.Forms.Form
	{
		#region Private...
		#region Properties
		private System.Windows.Forms.Button btCancel;
		private System.Windows.Forms.Button btOk;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox tbName;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.Windows.Forms.ComboBox cbCultures;
		private System.ComponentModel.IContainer components;
		#endregion

		#region Methods
		#region Dispose
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		#endregion

		#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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FrmAddColumn));
			this.btCancel = new System.Windows.Forms.Button();
			this.btOk = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.tbName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
			this.cbCultures = new System.Windows.Forms.ComboBox();
			this.SuspendLayout();
			// 
			// btCancel
			// 
			this.btCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btCancel.Location = new System.Drawing.Point(264, 168);
			this.btCancel.Name = "btCancel";
			this.btCancel.Size = new System.Drawing.Size(72, 40);
			this.btCancel.TabIndex = 5;
			this.btCancel.Text = "Cancel";
			this.toolTip1.SetToolTip(this.btCancel, "Click to cancel.");
			this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
			// 
			// btOk
			// 
			this.btOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btOk.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btOk.Location = new System.Drawing.Point(184, 168);
			this.btOk.Name = "btOk";
			this.btOk.Size = new System.Drawing.Size(72, 40);
			this.btOk.TabIndex = 4;
			this.btOk.Text = "OK";
			this.toolTip1.SetToolTip(this.btOk, "Click to save new Language Column.");
			this.btOk.Click += new System.EventHandler(this.btOk_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox1.Location = new System.Drawing.Point(16, 152);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(320, 3);
			this.groupBox1.TabIndex = 9;
			this.groupBox1.TabStop = false;
			// 
			// tbName
			// 
			this.tbName.Location = new System.Drawing.Point(16, 40);
			this.tbName.MaxLength = 50;
			this.tbName.Name = "tbName";
			this.tbName.Size = new System.Drawing.Size(320, 26);
			this.tbName.TabIndex = 10;
			this.tbName.Text = "";
			this.toolTip1.SetToolTip(this.tbName, "Enter the Language Column Name here.");
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(54, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(244, 23);
			this.label1.TabIndex = 11;
			this.label1.Text = "Language Column Name";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(56, 80);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(244, 23);
			this.label2.TabIndex = 13;
			this.label2.Text = "Available Cultures";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// cbCultures
			// 
			this.cbCultures.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cbCultures.Location = new System.Drawing.Point(16, 112);
			this.cbCultures.Name = "cbCultures";
			this.cbCultures.Size = new System.Drawing.Size(320, 26);
			this.cbCultures.TabIndex = 14;
			this.toolTip1.SetToolTip(this.cbCultures, "Select the Culture here.");
			// 
			// FrmAddColumn
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(7, 19);
			this.ClientSize = new System.Drawing.Size(352, 218);
			this.ControlBox = false;
			this.Controls.Add(this.cbCultures);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.tbName);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.btCancel);
			this.Controls.Add(this.btOk);
			this.Font = new System.Drawing.Font("Tahoma", 11.25F);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "FrmAddColumn";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "ResxWriter - Add New Language Column";
			this.Load += new System.EventHandler(this.FrmAddColumn_Load);
			this.ResumeLayout(false);

		}
		#endregion

		#region btOk_Click
		private void btOk_Click(object sender, System.EventArgs e)
		{
			if (this.CheckInput())
			{
				CultureInfo ci = this.cbCultures.SelectedItem as CultureInfo;
				ClsLanguage newLang = new ClsLanguage(this.tbName.Text, ci.ToString());
				ClsMain.settings.LanguageCollection.Add(newLang);
	
				this.DialogResult = DialogResult.OK;				
				this.Close();
			}			
		}
		#endregion		

		#region CheckInput
		private bool CheckInput()
		{	
			if (this.tbName.Text.Length == 0)
			{
				FrmMessage m = new FrmMessage();
				m.SetMessageText("ResxWriter - Error Message", 
					"You must enter a name for the new language column!");
				m.ShowDialog();
				return false;
			}			
			
			// unique lang column //
			CultureInfo ci = this.cbCultures.SelectedItem as CultureInfo;
			ClsLanguage l = new ClsLanguage(this.tbName.Text, ci.ToString());
			if (ClsMain.settings.LanguageCollection.Contains(l))
			{
				FrmMessage m = new FrmMessage();
				m.SetMessageText("ResxWriter - Error Message", "Language Column already used!!" 
					+ "\n\nYou must specify a unique name/culture for the new language column!");
				m.ShowDialog();
				return false;
			}			
				
			return true;		
		}
		#endregion

		#region btCancel_Click
		private void btCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
		#endregion

		#region FrmAddColumn_Load
		private void FrmAddColumn_Load(object sender, System.EventArgs e)
		{			
			this.cbCultures.DataSource = CultureInfo.GetCultures(CultureTypes.AllCultures);
			this.cbCultures.DisplayMember = "EnglishName";
		}
		#endregion
		#endregion
		#endregion

		#region Public...
		#region Constructor
		/// <summary>
		/// Default Constructor.
		/// </summary>
		public FrmAddColumn()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();			
		}
		#endregion		
		#endregion
	}
}

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Patrick Bounaix
Web Developer
United States United States
- philosophy
- french
- computer science

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150331.1 | Last Updated 17 Nov 2006
Article Copyright 2005 by Patrick Bounaix
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid