Populate textbox with dynamic uploaded word file
Hi Please help me in completing my requirement.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Amitesh VermaRank #2,535 · 552 reputationPosted Jul 28, 2015, 9:16 PM EDT
Raman Gulati10 reputationPosted Jul 29, 2015, 7:58 AM EDT
Raman Gulati10 reputationPosted Jul 29, 2015, 7:58 AM EDT
Amitesh VermaRank #2,535 · 552 reputationPosted Jul 29, 2015, 9:01 PM EDT
{
try
{
String directory = ConfigurationSettings.AppSettings["path"];
string filepath = directory + "//" + destinationName;
string text = File.ReadAllText(filepath);
string[] lines = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
int linecount = lines.Length;
int count = 0;
File.AppendAllText(errorfile, "" + Environment.NewLine);
File.AppendAllText(errorfile, "" + Environment.NewLine);
string section = string.Empty;
for (int i = 0; i < linecount; i++)
{
count++;
string[] newlinedata = lines[i].Split(':');
for (int a = 0; a < newlinedata.Length; a++)
{
string[] linedata = newlinedata[a].Split(' ');
for (int b = 0; b < linedata.Length; b++)
{
string data = linedata[b];
if (data.Length > 6)
{
string matchCase = data.Substring(0, 6);
if (matchCase == "------")
{
section = linedata[b].Substring(6, 2);
if (section.Substring(1, 1) == ".")
{
section = "Section No:" + section.Substring(0, 1)+" ";
}
else
{
section = "Section No:" + section.Substring(0, 2);
}
}
//else
//{
// section = string.Empty;
//}
}
section =section;
if (data.Length > 4)
{
if (data == "Flash" || data == "FLASH" || data=="flash")
{
if (linedata.Length > b + 1)
{
string dataNew = linedata[b + 1];
if (dataNew == "Point" || dataNew == "Point." || dataNew == "Point:" || dataNew == "Point " || dataNew == "POINT" || dataNew == "POINT:" || dataNew=="point")
{
if (section == "Section No:" || section=="")
{
section = "";
}
else
{
label4.Visible = true;
File.AppendAllText(errorfile, "Error Type 4. Line No:" + count + " " + section + " " + lines[i] + Environment.NewLine);
label4.Text = "Error Type 4. FLash Point Found";
}
}
}
}
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}