Can't compilie ; expected

  • Thread starter Thread starter Robert Blackwell
  • Start date Start date
R

Robert Blackwell

I'm following along in my book and here's the last bit of code

public static void Main()
{

Window w = new Window(5,10);
w.DrawWindow();

ListBox 1b = new ListBox(20,30,"Hellow World");
1b.DrawWindow();
}

In VS, I'm getting red squiglies under 1b and it will not compile because on
lines 52 and 53 ; expected

However, if I change 1b to me the squiglies are gone and it compiles just
fine.

Why can't I create "1b"? Is this an issue concerning changes in .net
framework when it was first released and the current 1.1? I dont' know, just
thinkin out loud.

Thanks in advance
 
Robert Blackwell said:
I'm following along in my book and here's the last bit of code

public static void Main()
{

Window w = new Window(5,10);
w.DrawWindow();

ListBox 1b = new ListBox(20,30,"Hellow World");
1b.DrawWindow();
}

In VS, I'm getting red squiglies under 1b and it will not compile because
on
lines 52 and 53 ; expected

However, if I change 1b to me the squiglies are gone and it compiles just
fine.

Why can't I create "1b"? Is this an issue concerning changes in .net
framework when it was first released and the current 1.1? I dont' know,
just
thinkin out loud.

Thanks in advance
That looks like a 1(one) to me, try using an l(L). I suspect that your
problem is being caused by trying to start an identifier with a number.
 
Okay, duh that makes sense.

I was thinkin to myself...oneb...okay, whatever.
heh

Good to know, an identifier can not start with a number nor can it solely be
a number.
 
Robert said:
Okay, duh that makes sense.

I was thinkin to myself...oneb...okay, whatever.
heh

Good to know, an identifier can not start with a number nor can it
solely be a number.

See the C# spec in section 2.4.2 for the complete rules regarding identifier
naming.

- Pete
 
Back
Top