473,769 Members | 5,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically creating an object

Type codeDomProvider Type =
Type.GetType("M icrosoft.CSharp *.CSharpCodePro vider", true);
ObjectHandle objHandle = Activator.Creat eInstance(null,
"Microsoft.CSha rp.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 1636
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("M icrosoft.CSharp .CSharpCodeProv ider, system,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9,
Custom=null", true);

HTH,
Alexander

"ThisBytes5 " <Th********@gma il.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Type codeDomProvider Type =
Type.GetType("M icrosoft.CSharp *.CSharpCodePro vider", true);
ObjectHandle objHandle = Activator.Creat eInstance(null,
"Microsoft.CSha rp.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\assembl y 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("M icrosoft.CSharp .CSharpCodeProv ider, system, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9, 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********@gma il.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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\assembl y 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("M icrosoft.CSharp .CSharpCodeProv ider,

system,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9,

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
12581
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)"; document.getElementById('myelement') = new Function("myfnc(param1,param2,param3)");
8
4833
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
1919
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 a new thread to display a customer on the screen for example. However, I have a problem with circular references in my objects which means that I have to load the customer object using reflection ie :
7
6787
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 = LoadOracleData(sql) '____Do amazing things
3
1090
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 plugin and will be dynamically loaded to the app. Example: 1. My application as a public variable 2. The control must receieve the value of the public variable 3. The control will do some math and encryption of the variable
5
2029
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 = rowDS.Item("Option_Item_Desc") chkCatOption.ID = rowDS.Item("ID").ToString chkCatOption.Checked = rowDS.Item("HasOption") chkCatOption.AutoPostBack = True AddHandler chkCatOption.CheckedChanged, AddressOf AddOrUpdate
6
1497
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 subroutine on postback. To me it seems like the button click event looks for a client script instead of going to the aspx codepage and execute the sub there. The same thing happens with textboxes, where I programatically add
6
5459
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 object. My problem is that I would like to create the objects dynamically but I can't figure out how to do it How would I go about dynamically creating the required objects so that I could be using anywhere from 2 - 10 etc. ?
10
2582
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 is that it's not destroyed, but I'm not sure. I have the following program: #include<iostream>
4
2975
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 while and it seems it's not possible because the row that gets added with each click won't get recreated after a post back. After all the reading it seems that any dynamically created controls must be created in the Init event to be recreated after...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.