[Mono-devel-list] Not sure why this won't compile

Paul paul at all-the-johnsons.co.uk
Mon Aug 1 19:04:45 EDT 2005


I have two source files (below). If I compile them up with
-r:System.Drawing and -r:System.Windows.Forms, I get an error about the
first file on the line which has EventArgs in it. Am I wrong in thinking
that if I compile both files at the same time that EventArgs in the
first file should be resolved by -r:S.W.F?

// FECdomain.cs
using System.Text.RegularExpressions;

delegate void StringSplitHandler(object src, SplitStringArgs args);

class SplitStringArgs : EventArgs
  private SplitStringArgs() {}
  public SplitStringArgs(string[] strings)
    this.strings = strings;

  string[] strings;
  public string[] Strings
    get { return strings; }
    set { strings = value; }

class DomainSplitter
  Regex re = new Regex("\\s");
  string[] substrings;

  public event StringSplitHandler StringsSplit;

  public void SplitString(string inStr)
    substrings = re.Split(inStr);
    StringsSplit(this, new SplitStringArgs(substrings));

using System;
using System.Drawing;
using System.Windows.Forms;

class FECdomain : Form
  TextBox tb = new TextBox();
  Button b = new Button();
  label[] labels;
  DomainSplitter domainObject = new DomainSplitter();

    tb.Location = new Point(10, 10);
    tb.Text = "The quick brown fox";
    b.Location = new Point(150, 10);
    b.Text = "Split text";

    b.Click += new EventHandler(this.GUIEvent);
    domainObject.StringsSplit += new

    this.Text = "Form-Event-Control";

  void GUIEvent(object src, EventArgs args)

  void DomainEvent(object src, SplitStringsArgs args)
    string[] strings = args.Strings;
    if (labels != null)
      foreach(Label l in labels)
    labels = new Label[strings.Length];

    int row = 40;
    for (int i = 0; i < labels.Length; i++)
      labels[i] = new Label();
      labels[i].Text = strings[i];
      labels[i].Location = new Point(100, row);
      row += 20;

  public static void Main()
    Application.Run(new FECdomain());

mcs FECdomain.cs FECdomain2.cs -r:System.Windows.Forms -r:System.Drawing
FECdomain.cs(6) error CS0246: The type or namespace name `EventArgs'
could not be found. Are you missing a using directive or an assembly
Compilation failed: 1 error(s), 0 warnings.


"Some people will do anything for a woman in uniform" - The Doctor -
Unregenerate (Big Finish audio)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050802/d2f1cb22/attachment.bin 

More information about the Mono-devel-list mailing list