|
Essentially what I need to do is convert this code
<br />
CSSDBLIB.ImportClass DLImport = new ImportClass();<br />
DLImport.Files.Add(strFilePath);<br />
to code that uses reflection. I need this to be late-bound.
This is what I have so far
<br />
Type tDLImport = Type.GetTypeFromProgID("CSSDBLIB.Import");<br />
object DLImport = tDLImport.InvokeMember("Import",BindingFlags.CreateInstance, null, null, null);<br />
I can't figure out how to invoke the Add method of the Files property dynamically for this instance of the DLImport object.
???
Hope that makes sense.
Jared
|
|
|
|
|
First, you can't invoke a method on a property. A property is a method that returns or set something.
But you can invoke a method on the instance returned by the property getter, should you get an instance.
First you'll need to invoke the property getter which will be named
<br />
get_insertPropertyNameHere<br />
If an instance is returned from that call you can invoke the Add method on it.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Duh. What a brainfart! I was thinking about this all wrong. I have to do something like this.
<br />
object DLfiles = tImport.InvokeMember("Files", BindingFlags.GetProperty, null, DLImport, null);<br />
Type tImportFiles = Type.GetTypeFromProgID("CSSDBLIB.ImportFiles");<br />
tImportFiles.InvokeMember("Add", BindingFlags.InvokeMethod, null, DLfiles, new object[] { fullPath });<br />
|
|
|
|
|
Hi all..
Hi do I save a copy of XSD..I have a button called save that opens a savedialog. I want to save a copy of my current DataSet as a new file on a path chosen on the Save Dialog. Eg."c:\"29/03/43.xsd"".
Thanks is advance
Is this chair taken
|
|
|
|
|
Hello, I'm not sure about how to customize formats in strings.
I.e, I want a string that is an integer number, but with some zeros at the beginning to have a certain length.
So, if I have an integer value: i = 1, I want to convert it to string so it gets: "000001", with length 6.
I'm trying with i.ToString(), trying to guess which format to put to achieve that. Do you know the solution?
Regards,
Diego F.
|
|
|
|
|
I found other way to get that without the format method. I used the Padleft method and I get the same
Regards,
Diego F.
|
|
|
|
|
|
or ToString("D6");
analogous to ToString("X8"); for hex
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I was sure it was simple, but is soooo simple that I'm feeling embarrased
Regards,
Diego F.
|
|
|
|
|
This is a newbie question:
I have read lots of tutorials on how to add a datasource to project.
How to I cleanly remove a datasource or databindings from a project?
This has been a real pain for me. I have to spend a lot of time manually going through code to make sure all the references to these deleted form objects are removed.
Whats the best way?
TIA,
shwa guy.
|
|
|
|
|
The best way? You're already doing it. Since the designer cannot know what impact removing all of the references to the dataset would have on your code, it just doesn't touch it.
The absolute best way is to plan your data model more carefully so your not deleting datasources all the time.
|
|
|
|
|
Is there a way to suspend a thread until an event is triggered?
|
|
|
|
|
The System.Threading namespace contains some classes for thread synchronization.
e.g. ManualResetEvent.WaitOne()
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
I have some Form ( WinForm ) that on him i have button "Help".
I want to make the keyboard button F1 enable and in case that the application user will press on the F1 => then the help button will be press / or the some method in my application will be call.
How to do it ?
Thanks for any help.
|
|
|
|
|
Yanshof wrote: have some Form ( WinForm ) that on him i have button "Help".
You can set short cut key for that menu as F1. Then menu code will be called
|
|
|
|
|
Ok, And how do i do it ?
Is there is some other way ?
|
|
|
|
|
Create a new form - This form will be the help window.
Now, click in the main form, and set it's KeyDown event.
Write the following code in the event handler:
if (e.KeyCode == Keys.F1)
{
HelpForm helpForm = new HelpForm();
helpForm.ShowDialog();
}
If your help form isn't called 'HelpForm' then write the correct name instead of.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Just handle Form.HelpRequested event
Edit: If ya want to have a "question mark"-button in the top-right corner, set HelpButton property to true and both MaximizeBox and MinimizeBox to false;
-- modified at 11:50 Tuesday 25th September, 2007
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Why not add a System.Windows.Forms.HelpProvider by dropping one onto your form, set its HelpNamespace to the .chm file you want to open and then in your form's properties, set the HelpKeyword and HelpNavigator properties?
the Visual Studio 2005 documentation has an example in C# for the HelpProvider class.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
How can I make the Label to be a fixed width and span more than one row?
_____________________________
...and justice for all
APe
|
|
|
|
|
Set property AutoSize to false
|
|
|
|
|
Pls i want to use the getdate() sql method to get time insert it into sql database and make sure that the column in the database is always reading the current time.That means it may have to update the time every second.How do i do this?
IT'S GREAT TO BE HERE
|
|
|
|
|
You've already asked this question on the SQL forum.
What has this got to do with C#?
Paul
|
|
|
|
|
Hello
I make a form, where i choose the server and the database
- How can i get all the database in the specific serveer that i choose ?
Thanks a lot
Assaf
|
|
|
|
|
Query the table sysdatabases in the master database (which is always available if the user has sufficient permission)
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|