Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:06:17+00:00 2026-06-14T22:06:17+00:00

as the title suggests im trying to send a file acquired by stream reader

  • 0

as the title suggests im trying to send a file acquired by stream reader to another class so that that class can extract the information from it. I have tried extracting it within the form but this makes it confusing and im certain is a poor way of doing it. Can anyone suggest a way?

Here is the class that identifies the file..

namespace DistanceEstimatorFinal
{
    public partial class Form1 : Form


        private void openDataListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "CSV files (*.csv)|*.csv|Text files ( *.txt)|*.txt |All files (*.*)|*.*";
            if (ofd.ShowDialog(this).Equals(DialogResult.OK))
            {
                Stream fileStream = ofd.OpenFile();

                using (StreamReader reader = new StreamReader(fileStream))
                {

                }
            }
        } 

Now I need some way of sending it here… I can’t see how :[

namespace DistanceEstimatorFinal
{

    public class dataPoints
    {
        List<dataPoint> Points;
        public dataPoints( )
        {
            Points = new List<dataPoint>();
            TextReader tr = new StreamReader();
            string input;
            while ((input = tr.ReadLine()) != null)
            {
                string[] bits = input.Split(',');
                dataPoint a = new dataPoint(bits[0],bits[1],bits[2]);              
                Points.Add(a);  


            }

            tr.Close();
        }

        internal dataPoint getItem(int p)
        {
            if (p < Points.Count)
            {
                return Points[p];
            }
            else
                return null;
        }
    }

}

Any help would be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:06:17+00:00Added an answer on June 14, 2026 at 10:06 pm

    I would just pass the path of the file to your class and then open the file for reading.

    if (ofd.ShowDialog(this).Equals(DialogResult.OK))
    {
        var path = ofd.FileName;
    
        //Pass the path to the dataPoints class and open the file in that class.
    }
    

    You could pass the path in the constructor of the class or to the method itself as a parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title suggests is it possible to execute another java app from within
As the title suggests, I am trying to essentially copy values from one textbox
So as the title suggests, I'm trying to get and gunzip a string from
As the title suggests, I'm trying and failing to get the following combination working
As the title suggests, I'm trying to get the caption of the associated label
As the title suggests I am trying to add an event listener to a
As the title suggests I'm simply trying to get a named window to come
As the title suggestes im trying to work out how I can show an
As the title suggests I've been trying to trigger a onmousedown even and then
As the Title suggests, i am trying to find how to insert image in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.