I'm stuck - Hope to get some help!


Author
Message
Ben Hayat
Ben Hayat
Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)
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
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ben Hayat - 17 Years Ago
Chan - 17 Years Ago
Ben Hayat - 17 Years Ago
Ben Hayat - 17 Years Ago
StrataFrame Team - 17 Years Ago
                         [quote]It's confusing because in VB, Type.GetType("MyFormName") and...
Ben Hayat - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search