This has happened on 2 PC's (work & home) with both VB Express & C# Express.
I'll use C# as the example.
When you create a form you automatically get "using Foo;" created at the top. I'll use System.Data as an example. Since it's already "using System.Data", I expand that and add OleDB to the end of that. No intellisense but no worries, it works.
I create the connection object as such:
OleDBConnection conn = new OleDBConnection();
This works fine too, intellisense pops up and finds everthing fine.
However...on the next line when I type in:
conn. (Object does NOT exist in Intellisense window).
Further more if I manually type out (conn.ConnectionString = "Foo";) I get an error saying
"Invalid token '=' in class, struct, or interface member declaration."
Its like the IDE will let me create the object but doesn't see it after I create it. Why
I've created some custom classes which is how I found this problem to begin with, the IDE recognizes that my classes exist and lets me create an object but the object then does not show up in Intellisense nor does it allow me to access the properties of those classes once the object is created.
I have no idea why this is happening. My PC at work the C# Express Edition was doing this initially and a coworker and I finally got it to work correctly but I do not remember how we did it and I've wasted hours trying to get this to work on my laptop.
This also happens in Visual Studio 2005 Beta 2. I guess I'm doing something wrong here but no idea what.
Please help!

Problem with classes & objects???
Minna
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
conn.ConnectionString = "foo"; // This will work just fine
InitializeComponent();
}
OleDbConnection conn = new OleDbConnection(); This line is fine. No errors.
}
}
Karunakaran
public class Foo {
private int m_bar;
m_bar = 42; // illegal!!!
}
The following is legal:
public class Foo {
private int m_bar = 42; // legal
}
as is:
public class Foo {
private int m_bar;
public Foo() {
m_bar = 42; // legal
}
}
TechTnT
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OleDbConnection conn = new OleDbConnection(); This line is fine. No errors.
conn.ConnectionString = "foo"; On this line, "conn" does not show up in intellisense, and I get an error on the = sign saying "Invalid token '=' in class, struct, or interface member declaration.
}
}
I was originally getting this error when I was creating an instance of a custom class I had created. I fell to creating a connection object because I have done this a thousand times and I wanted to rule out a problem with my custom class. When this didn't work either and I got the same error I knew something was wrong.
If I create instances of other objects, OleDBCommand, DataReader, when I try to access a property or method of the instance of those the same thing happens. The object does not show up in Intellisense (like it should) and if I manually type out a property or method I know exists, same error happens.
I don't get it.
None007
Put conn.ConnectionString = "foo"; in a member function.
Cheers
Randy