fairly new to C# here…
…What I’m trying to do is parse a bunch of text to a webpage from a .txt file uploaded to memory.
Here’s what the .txt file looks like
.RES B7=121 .RES C12=554 .RES VMAX=4.7μV
Again, it goes on like this for another 50 or so .RES’…
I’ve successfully got it to parse, but not in the desired format…
Here’s how I want it to look on the webpage
B7.........121
C12.........554
VMAX.........4.7μV
all inside of a hidden panel with id=”outpt”… which is currently set to visible=”false”
Here’s the code i’m using in my C# Page
namespace Sdefault
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpld_Click(object sender, EventArgs e)
{
Stream theStream = file1.PostedFile.InputStream; //uploads .txt file to memory for parse
using (StreamReader sr = new StreamReader(theStream))
{
string tba;
while ((tba = sr.ReadLine()) != null)
{
string[] tmpArray = tba.Split(Convert.ToChar("=")); //Splits ".RES B7=121" to "B7"... but for some reason, It prints it as
//".RES B7.RES C12.RES VMAX"... I would ultimately desire it to be printed as shown above
Response.Write(tmpArray[0].ToString());
var.Text = tba;
outpt.Visible = true;
}
}
}
}
}
Any pointers in which direction I should go with this?
1 Answer