Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Syntax Errors


  • Please log in to reply
5 replies to this topic

#1 MLW

MLW

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDartmouth, NS, Canada

Posted 14 October 2011 - 01:02 PM

Hello I found this piece of code online and when I tried it it ddn't work could is it possible to know what directory in missing from my code?

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Microsoft.SPOT.IO;
//using SecretLabs.NETMF.IO;
using System.IO;

namespace SD_CARD
{
public class SD_CARD
{
private static void main()
{
using (var filestream = new FileStream(@"SD\don't panic.txt", FileMode.Create))
{
StreamWriter streamWriter = new StreamWriter(filestream);
streamWriter.WriteLine("Hello Netduino!!!");
streamWriter.Close();
}
using (var filestream = new FileStream(@"SD\don't panic.txt", FileMode.Open))
{
StreamReader Reader = new StreamReader(filestream);
Debug.Print(Reader.ReadToEnd());
Reader.Close();
}
}
}
}

The bold text is the syntax errors I got after writing the code. I got 1 error which is about the missing reference to IO but don't know which one because when I add using secretlabs.netfm.io it doesn't find the dll file either, do I need to download it from somewhere?

Sorry about the long email but i really need to figure out how to use the usd and the netduino plus.

#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 14 October 2011 - 05:39 PM

StreamReader Reader = new StreamReader(filestream);
The bold text is the syntax errors I got after writing the code. I got 1 error which is about the missing reference to IO but don't know which one because when I add using secretlabs.netfm.io it doesn't find the dll file either, do I need to download it from somewhere?

Sorry about the long email but i really need to figure out how to use the usd and the netduino plus.

I think you are missing a reference - Add the System.IO to the references section of your project. You can also delete the other two IO using statements.

Hope this helps,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 scanman

scanman

    New Member

  • Members
  • Pip
  • 2 posts

Posted 15 October 2011 - 08:05 AM

I have a similar problem, i added a reference to system.io but system.io only has "Ports" and not "directory" or "filestream"

#4 MLW

MLW

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDartmouth, NS, Canada

Posted 15 October 2011 - 12:22 PM

Thank you Mark It did work I thought I added it to references but officely it was missing Mariam

#5 MLW

MLW

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDartmouth, NS, Canada

Posted 15 October 2011 - 04:05 PM

Hello scanman I got it as soon as I added it to references it worked. Did you add it to references in solution explorer? Mariam

#6 georgejh

georgejh

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • LocationGlasgow, UK

Posted 15 October 2011 - 04:13 PM

Right click on the "References" folder inside the project's structure and add reference to System.IO




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.