Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. IOExpection error using Streamreader and FileStream

IOExpection error using Streamreader and FileStream

Scheduled Pinned Locked Moved C#
helpcsharpgraphicstestingbeta-testing
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yefeng_law
    wrote on last edited by
    #1

    hi, this is exactly my first program, i will be using C#. The device i am using is a usb connected PC digital TV receiver this receiver software actually have a function which measure the signal strength, BER and these data are save into an log file (thus it real time measurement data) once i start the device (start watch TV). I am suppose to use C# to get the real time measurement and convert it into graphic (line chart). I have try to get the data for the log file and display it in the textbox using the following code using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Testing_1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { StreamReader objstream = new StreamReader("c:\\measurement.log"); textBox1.Text = objstream.ReadToEnd(); } but this is the error i got : IOExpection was unhandled the file been use by another program. I also try another method which is directly from the usb port which the device is connected to but i am unable to start working on it coding. i had been looking into example of usb_hib and ICSHARPUSBlib but i was unable to get anything out. Thus please help me, if i am in the right direction (get the data from usb directly?) or do you have any better item on how i should get this done, any code to refer to. thank so much

    H Z 2 Replies Last reply
    0
    • Y yefeng_law

      hi, this is exactly my first program, i will be using C#. The device i am using is a usb connected PC digital TV receiver this receiver software actually have a function which measure the signal strength, BER and these data are save into an log file (thus it real time measurement data) once i start the device (start watch TV). I am suppose to use C# to get the real time measurement and convert it into graphic (line chart). I have try to get the data for the log file and display it in the textbox using the following code using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Testing_1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { StreamReader objstream = new StreamReader("c:\\measurement.log"); textBox1.Text = objstream.ReadToEnd(); } but this is the error i got : IOExpection was unhandled the file been use by another program. I also try another method which is directly from the usb port which the device is connected to but i am unable to start working on it coding. i had been looking into example of usb_hib and ICSHARPUSBlib but i was unable to get anything out. Thus please help me, if i am in the right direction (get the data from usb directly?) or do you have any better item on how i should get this done, any code to refer to. thank so much

      H Offline
      H Offline
      Harvey Saayman
      wrote on last edited by
      #2

      Re-posting your question is considered rude!

      Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

      Y 1 Reply Last reply
      0
      • Y yefeng_law

        hi, this is exactly my first program, i will be using C#. The device i am using is a usb connected PC digital TV receiver this receiver software actually have a function which measure the signal strength, BER and these data are save into an log file (thus it real time measurement data) once i start the device (start watch TV). I am suppose to use C# to get the real time measurement and convert it into graphic (line chart). I have try to get the data for the log file and display it in the textbox using the following code using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Testing_1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { StreamReader objstream = new StreamReader("c:\\measurement.log"); textBox1.Text = objstream.ReadToEnd(); } but this is the error i got : IOExpection was unhandled the file been use by another program. I also try another method which is directly from the usb port which the device is connected to but i am unable to start working on it coding. i had been looking into example of usb_hib and ICSHARPUSBlib but i was unable to get anything out. Thus please help me, if i am in the right direction (get the data from usb directly?) or do you have any better item on how i should get this done, any code to refer to. thank so much

        Z Offline
        Z Offline
        zafersavas
        wrote on last edited by
        #3

        I think the reason for the answer is obvious : "c:\\measurement.log" is being used by another program. Instead of reading the log file and displaying the results, you should directly get data from the usb device.

        yefeng_law wrote:

        I also try another method which is directly from the usb port which the device is connected to but i am unable to start working on it coding

        Why? have a look at the examples and if still can not solve contact the manufacturer of the device for library. Thats the only way I think.

        1 Reply Last reply
        0
        • H Harvey Saayman

          Re-posting your question is considered rude!

          Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

          Y Offline
          Y Offline
          yefeng_law
          wrote on last edited by
          #4

          hi Harvey Saayman i repost my question after listening to your advice on reading the following forum (How to use the code project forums[^]), thus i repost my question with the title other could understand more, i am sorry i didnt know this action consider rude. I am just hoping I could be able to get help. yefeng_law

          H 1 Reply Last reply
          0
          • Y yefeng_law

            hi Harvey Saayman i repost my question after listening to your advice on reading the following forum (How to use the code project forums[^]), thus i repost my question with the title other could understand more, i am sorry i didnt know this action consider rude. I am just hoping I could be able to get help. yefeng_law

            H Offline
            H Offline
            Harvey Saayman
            wrote on last edited by
            #5

            yes the subject is better this time, but you can edit the original post, you dont have to make a new one

            yefeng_law wrote:

            I am just hoping I could be able to get help.

            and will get help if someone here is able to help you, your new so its fine... but dont repost a question just to get it back on the first page etc.

            Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

            Y 1 Reply Last reply
            0
            • H Harvey Saayman

              yes the subject is better this time, but you can edit the original post, you dont have to make a new one

              yefeng_law wrote:

              I am just hoping I could be able to get help.

              and will get help if someone here is able to help you, your new so its fine... but dont repost a question just to get it back on the first page etc.

              Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

              Y Offline
              Y Offline
              yefeng_law
              wrote on last edited by
              #6

              Thank i understand what you mean. Regard yefeng_law

              H 1 Reply Last reply
              0
              • Y yefeng_law

                Thank i understand what you mean. Regard yefeng_law

                H Offline
                H Offline
                Harvey Saayman
                wrote on last edited by
                #7

                cool so has there been any progress with your program?

                Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                Y 1 Reply Last reply
                0
                • H Harvey Saayman

                  cool so has there been any progress with your program?

                  Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                  Y Offline
                  Y Offline
                  yefeng_law
                  wrote on last edited by
                  #8

                  Sad to say no progress at all. I think i would have to get the data from the usb port but i have problem programming even after looking at the code from some example to be correct i don't even know how to start with it. I think i will be dead drop. Anyway thank,would be nice if you have any recommendation for me.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups