Hi, I'm working on a graphics transformation program, setting up a listbox to read in the names of files in a directory. The code is based off an example from my instructor, so I thought it would work fine, but it seems to create errors everywhere. I googled "error CS1519: Invalid token ‘,’ in class, struct, or interface member declaration", but what I found looked unapplicable. Here it is:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Transformer
{
public partial class Transformer : Form
{
/* Initialize parameters */
private bool drawAxes = true;
private bool drawGrid = true;
private List<ObjectSettings> dispObjects = new List<ObjectSettings>();
/* Initialize form */
public Transformer()
{
InitializeComponent();
}
private void Transformer_Load(object sender, EventArgs e)
{
}
/* Populate available objects listbox */
private int selFile = 0;
private string currentDir = Directory.GetCurrentDirectory();
// errors start around here
private string[] fileEntries = Directory.GetFiles(currentDir+@"\Objects");
foreach (string s in fileEntries) {
int start = s.LastIndexOf(@"\");
int end = s.LastIndexOf(@".");
availObjectsListBox.Items.Add(s.Substring(start + 1, end - start - 1));
} // end foreach
}
}