Iam sending required code...iam not getting about Read All Text option....can any one help please...
we have to displayed only the contents between any tags(<html> ,....or anything)
C#
private void cboxSelectTag_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(txtSelectedFile.Text!="")
{
int startIndex,endIndex;
rtbDisplayTagContents.Clear();
rtbDisplayTagContents.Visible=true;
Cursor=Cursors.WaitCursor;
switch(cboxSelectTag.SelectedItem.ToString())
{
case "Read All Text":
while(intStart<rtbGetHtmlFile.Text.Length && intStart!= -1)
{
startIndex=0;
endIndex=0;
intStart=0 ;
intParenthesisCount=0;
intStart=startIndex=rtbGetHtmlFile.Find(charStartSearchCharecter,endIndex,rtbGetHtmlFile.Text.Length);
if(intStart!=-1)
{
intStart++;
endIndex=rtbGetHtmlFile.Find(charEndSearchCharecter,intStart,rtbGetHtmlFile.Text.Length);
for(int i=startIndex;i<endIndex;i++)
{
if(rtbGetHtmlFile.Text[i]=='>')
{
intParenthesisCount++;
for(int j=i+1 ;endIndex<=0;j++,i++)
{
rtbDisplayTagContents.AppendText(rtbGetHtmlFile.Text[j].ToString());
}
}
}
}
}
Cursor=Cursors.Default;
if(rtbDisplayTagContents.Text=="")
{
rtbDisplayTagContents.Text="No Content";
}
rtbDisplayTagContents.Visible=true;
break;
case "HTML":
startIndex=rtbGetHtmlFile.Find("<html");
endIndex=rtbGetHtmlFile.Find("</html>");
for(int i=startIndex;i<endIndex;i++)
{
if(rtbGetHtmlFile.Text[i]=='>')
{
for(int j=i+1;rtbGetHtmlFile.Text[j]!='<';j++)
{
rtbDisplayTagContents.AppendText(rtbGetHtmlFile.Text[j].ToString());
}
}
}
Cursor=Cursors.Default;
if(rtbDisplayTagContents.Text=="")
{
rtbDisplayTagContents.Text="No Content";
}
rtbDisplayTagContents.Visible=true;
break;
Answers
Know the answer? Post it. Somebody with the same question will find it here.