>> [...]
>> It's telling me "frmConnect" is not available in this context.
[quoted text clipped - 13 lines]
>
> Pete
Sorry about that. I thought maybe it was a generalized question. The
code's on another machine.
private void connectToDBToolStripMenuItem_CLick(blah blah blah)
{
frmConnect.Show();
}
frmConnect is a form that is within the custom control environment.
Is more code than that needed? If so, I'll have to wait until later.
I have showing a treeview, a context menu on right click of the tree
view, and I'm calling this form from the menu to input the connection
string parameters.
Peter Duniho - 25 Feb 2008 05:37 GMT
> [...]
> private void connectToDBToolStripMenuItem_CLick(blah blah blah)
[quoted text clipped - 3 lines]
>
> frmConnect is a form that is within the custom control environment.
What do you mean by "custom control environment"? What environment?
And what do you mean by "is a form"? Is that a variable to which has been
assigned an instance of a class that inherits Form? Or is it the name of
a class that inherits Form? Is this a compiler error? Or run-time? What
is the _exact_ error text you're getting and in what context?
It kind of looks like you're trying to do in C# something that would work
in VB (but which you shouldn't do anyway, IMHO). But it's hard to say
without more specific information about what's actually going on (see the
previous paragraph for the kinds of specific information you've left out).
Pete
doofy - 25 Feb 2008 06:47 GMT
>> [...]
>> private void connectToDBToolStripMenuItem_CLick(blah blah blah)
[quoted text clipped - 19 lines]
>
> Pete
You're probably right, as I posted in the other email.
I don't know what the proper vernacular is. I'm in a custom control
project. I created a form within that project, thus the "custom control
environment".
I'll have to transfer the code from the other machine to here when I get
a chance.
I believe the info you've both given me in these last two posts might
point to the problem.
This is the first time I've tried to create a custom control, in any
language, so I'm sort of slogging through. Thanks for your help and
patience.
KWienhold - 25 Feb 2008 06:56 GMT
> >> [...]
> >> private void connectToDBToolStripMenuItem_CLick(blah blah blah)
[quoted text clipped - 37 lines]
>
> - Zitierten Text anzeigen -
I believe in VB there was a "default instance" of every form, so you
could call <FormType>.Show() and it would display that default
instance.
In C# this doesn't work, you'll have to create an instance of the form
before showing it, like so (assuming frmConnect is the name of the
class):
frmConnect FormConnect = new frmConnect();
FormConnect.Show();
hth,
Kevin Wienhold
Roger Frost - 25 Feb 2008 05:44 GMT
Is a frmConnect instance declared (or a public instance referred to) in the
class that contains your connectToDBToolStripMenuItem_CLick method?
For example:
FormConnect frmConnect = new FormConnect();
Is IntelliSense (if your using an environment that utilizes it) working with
frmConnect (ie. does it auto complete such things as frmConnect.Show() while
typing)?
If IntelliSense "knows who it is" then the complier should as well.

Signature
Roger Frost
"Logic Is Syntax Independent"
>>> [...]
>>> It's telling me "frmConnect" is not available in this context.
[quoted text clipped - 29 lines]
> and I'm calling this form from the menu to input the connection string
> parameters.
doofy - 25 Feb 2008 06:43 GMT
> Is a frmConnect instance declared (or a public instance referred to) in
> the class that contains your connectToDBToolStripMenuItem_CLick method?
[quoted text clipped - 8 lines]
>
> If IntelliSense "knows who it is" then the complier should as well.
Know, Intellisense isn't getting it. I'll try what you say above.
I'm just getting used to the .Net stuff and object instantiation
minutia. I'm too used to VB6 ways.
Peter Webb - 25 Feb 2008 07:00 GMT
>> Is a frmConnect instance declared (or a public instance referred to) in
>> the class that contains your connectToDBToolStripMenuItem_CLick method?
[quoted text clipped - 13 lines]
> I'm just getting used to the .Net stuff and object instantiation minutia.
> I'm too used to VB6 ways.
I'm a newbie, and I get that problem all the time.
I bet you have created your method inside another class by mistake. Try
moving it somewhere else.
doofy - 25 Feb 2008 14:14 GMT
>>> Is a frmConnect instance declared (or a public instance referred to)
>>> in the class that contains your connectToDBToolStripMenuItem_CLick
[quoted text clipped - 19 lines]
> I bet you have created your method inside another class by mistake. Try
> moving it somewhere else.
it is. It's in another namespace too. I just told it to add a form to
the project, and that's what it did.
doofy - 27 Feb 2008 13:42 GMT
> it is. It's in another namespace too. I just told it to add a form to
> the project, and that's what it did.
I made it work by preceding the object name with the other namespace
name, and by instantiating it with "new".
Thanks for everyone's help in jogging my brain in the right direction.