StrataFrame Forum
Back
Login
Login
Home
»
.NET Forums
»
General .NET Discussion
»
I'm stuck - Hope to get some help!
I'm stuck - Hope to get some help!
Post Reply
Like
0
I'm stuck - Hope to get some help!
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Ben Hayat
Ben Hayat
posted 17 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 374,
Visits: 1.2K
I'm stuck with a compile error and can't see it.
I have a simple method that starts a given form:
private void StartForm(System.Type MyFormType)
{
Form loForm;
loForm = Activator.CreateInstance(MyFormType) as Form;
loForm.Show();
}
Then for each item from the menu, I call this method and pass the class name of my form:
private void tsmStore_Click(object sender, EventArgs e)
{
// frmStore is the class name for store
StartForm(GetType(frmStore));
}
I then get this error:
'frmStore' is a 'type' but is used like a 'variable'
I'm passing the type of class name, but still like it.
What am I missing?
Thanks!
..ßen
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
I'm stuck - Hope to get some help!
Ben Hayat
-
17 Years Ago
Hi,
Try
private void tsmStore_Click(object sender,...
Chan
-
17 Years Ago
Thanks Chan;
But adding Type gives me this error:...
Ben Hayat
-
17 Years Ago
Ahh, never mind Chan; I had forgotten to put Double Quotes around....
Ben Hayat
-
17 Years Ago
Ah, the reason that it's giving you that is you're using GetType in...
StrataFrame Team
-
17 Years Ago
[quote]It's confusing because in VB, Type.GetType("MyFormName") and...
Ben Hayat
-
17 Years Ago
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search