M
MorenainHanoi
Guest
This program is supposed to import text file from my folder which is in the projectName>bin>debug, but somehow the
program isn't reading it. Can somebody help me point out the error? Thank you in advance for helping.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class FileLoader : Form
{
List<string> itemSaver;
StreamReader reader;
public FileLoader()
{
InitializeComponent();
itemSaver = new List<string>();
reader = new StreamReader("texter.txt", Encoding.Default, false);
}
private void button1_Click(object sender, EventArgs e)
{
this.button1.Text = "Browse";
string item;
if (File.Exists("texter.txt"))
{
reader = new StreamReader("texter.txt", Encoding.Default, false);
while ((item = reader.ReadLine()) != null)
{
itemSaver.Add(item.ToString());
}
foreach (string a in itemSaver)
{
string[] vektor = a.Split(new string[] { "###" }, StringSplitOptions.None);
}
}
}
}
Continue reading...
program isn't reading it. Can somebody help me point out the error? Thank you in advance for helping.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class FileLoader : Form
{
List<string> itemSaver;
StreamReader reader;
public FileLoader()
{
InitializeComponent();
itemSaver = new List<string>();
reader = new StreamReader("texter.txt", Encoding.Default, false);
}
private void button1_Click(object sender, EventArgs e)
{
this.button1.Text = "Browse";
string item;
if (File.Exists("texter.txt"))
{
reader = new StreamReader("texter.txt", Encoding.Default, false);
while ((item = reader.ReadLine()) != null)
{
itemSaver.Add(item.ToString());
}
foreach (string a in itemSaver)
{
string[] vektor = a.Split(new string[] { "###" }, StringSplitOptions.None);
}
}
}
}
Continue reading...