473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamically creating an object

Type codeDomProviderType =
Type.GetType("Microsoft.CSharp*.CSharpCodeProvider ", true);
ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodePr*ovider");
Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.
Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.

Nov 16 '05 #1
4 1617
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider, system,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
Custom=null", true);

HTH,
Alexander

"ThisBytes5" <Th********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Type codeDomProviderType =
Type.GetType("Microsoft.CSharp*.CSharpCodeProvider ", true);
ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodePr*ovider");
Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.
Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.
Nov 16 '05 #2
Thank you that did the trick.

Nov 16 '05 #3
Now that I look at the below a bit more, I have one more question.

Where does the custom come from? I've looked at the properties for
windows\assembly and have found everything else but the custom.

Alexander Shirshov wrote:
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider, system, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null", true);

HTH,
Alexander


Nov 16 '05 #4
No idea. I simply used "gacutil /l system" to get the full name.

HTH,
Alexander

"ThisBytes5" <Th********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Now that I look at the below a bit more, I have one more question.

Where does the custom come from? I've looked at the properties for
windows\assembly and have found everything else but the custom.

Alexander Shirshov wrote:
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider,

system,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,

Custom=null", true);

HTH,
Alexander

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
8
by: Falc2199 | last post by:
Hi, Does anyone know how to make this work? var sectionId = 5; repeat_section_sectionId(); function repeat_section_5(){ alert("firing"); }
6
by: Simon Verona | last post by:
I would normally use code such as : Dim Customer as new Customer Dim t as new threading.thread(AddressOf Customer.DisplayCustomer) Customer.CustomerId=MyCustomerId t.start Which would create...
7
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al =...
3
by: Daniel Friend | last post by:
I have an application and use custom user controls as plugins. Is there any way to communicate back and forth from control to app. NOTE: The control is not refrenced in the app, it will act as a...
5
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text...
6
by: Bjorn Sagbakken | last post by:
Hello In VS2005: I am adding buttons and textboxes dynamically into a table, that also dynamically expands. So far, so good, actually very nice. But I am having trouble starting the desired...
6
by: RSH | last post by:
Hi, i have a situation where I need to dynamically create objects in a loop. My question surrounds intantiation naming in such a scenerio. Below is a snippet that is basically hardcoding each...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.