TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Siva Ganesh Rongala
1.6k
124
6.6k
Add generated resource file into solution at runtime
May 3 2013 7:03 AM
Hi, I am creating resource file at run time through code its creating and displaying in resource folder but not showing in solution. But When i do it manually as add existing item, then it was working. Please give me the solution.
public void LaguageCulture(string languageid)
{
try
{
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@lagid", languageid);
//languageid =3
var dsResources = SqlHelper.ExecuteDataset(_objSqlConnection, "sproc_GetResourceNames", param);
string culturecode = string.Empty;
if (dsResources.Tables[1].Rows.Count > 0)
{
culturecode = dsResources.Tables[1].Rows[0][0].ToString();
}
FileInfo file = new FileInfo(System.Windows.Forms.Application.StartupPath.Replace("\\bin\\Debug", "") + "\\Resources\\EnglishResource." + culturecode + ".resx"); // Culture code is en-US
if (!file.Exists)
{
var resx = new ResXResourceWriter(System.Windows.Forms.Application.StartupPath.Replace("\\bin\\Debug", "") + "\\Resources\\EnglishResource." + culturecode + ".resx");
if (dsResources.Tables[0].Rows.Count > 0)
{
for (var i = 0; i < dsResources.Tables[0].Rows.Count; i++)
{
resx.AddResource(dsResources.Tables[0].Rows
["ResourceName"].ToString(), dsResources.Tables[0].Rows
["ResourceValue"].ToString());
}
}
resx.Generate();
//Application.Current.Resources.Add(culturecode + ".resx", resx);
resx.Close();
}
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culturecode);
System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(culturecode);
}
catch (Exception)
{
throw;
}
}
Reply
Answers (
0
)
Clone the Generic type
Data table from one Xaml window to another