|
You should use reflection
1.in runtime Dynamicly write a method
2.Add DllImport Attribute to it and add dll path
3.Invoke the method
by Sedat Kurt
|
|
|
|
|
Could you give me an example of this please?
|
|
|
|
|
|
thestonefox wrote: Error 7 'myclass.mypath' is of type 'string.' A const of reference type other than string can only be initialized with null
I'm confused by this because I thought ConfigurationManager.AppSettings["mypath"] returned a String, so why cant I just use that?
It looks like the variable mypath is declared as a const. You are probably declaring this a member variable though. your line of code probably looks like public const string mypath = ConfigurationManager.AppSettings["mypath"] . Try not declaring the variable as a constant, and it should work.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
The variable has to be a constant as it is used in
[DllImport(mypath, EntryPoint="runme", ExactSpelling=true, SetLastError=false, CallingConvention = CallingConvention.Cdecl)]
where mypath is used is outside the main constructor so it requires to be a constant
|
|
|
|
|
thestonefox wrote: mypath = ConfigurationManager.AppSettings["mypath"]
mypath cannot be constant. Constants are "baked" into assembly at compile time. Value from configuration file is taken at run time.
thestonefox wrote: [DllImport(mypath+"mydll.dll", EntryPoint="runme", ExactSpelling=true, SetLastError=false, CallingConvention = CallingConvention.Cdecl)]
Also you can't do this, attributes are metadata, again compile time.
What Sedat said should work (I don't know if there is any way how to imperatively do dll import, you could try your luck with Google/MSDN on PInvoke).
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I think the easiest thing to do would be to write a native DLL in C/C++ that dynamically loads DLLs via LoadLibrary and GetProcAddress and calls "runme". Your DLL function might be declared like this:
void CallRunme( const TCHAR *pszDLL, int param1, int param2 ); Call this from .NET via PI and pass the DLL name as the first param.
|
|
|
|
|
FileInfo thefile = new FileInfo(MapPath("RtfFilesPath") + "\\" + txtOriginalName.Text);
if (thefile.Exists)
{
File.Copy(MapPath("RtfFilesPath") + "\\" + txtOriginalName.Text, MapPath("RtfFilesPath") + "\\" + txtFilename.Text);
}
this is the snippet i am using in my code this is working fine but it is expecting me to type the whole filename with extension.can anybody suggest me what to do to if i want to ignore the extension of the file for the original filename which is in the txtOriginalName.text
iwant to give only the filename before the . in the textboxes
regards
sunilwise
-- modified at 4:58 Monday 12th November, 2007
|
|
|
|
|
Why do you think that you need a MSDN subscription for sharing your own code??
|
|
|
|
|
I mean, ya.. at least, you wrote this program, right? and you don't read the Microsoft Shared Code which are under the MS ref license, rigth? then, I think you won't need MSDN subscription for distributing your program... If you want more details about confirmation, you can probably contact with Microsoft..
|
|
|
|
|
In the drop dowm list (ASP.Net) control we can bound the display text and the value of the item.
Same way, is there any other option to bound the display value and the item value separately.
There is a property selected value for the combo box, but there is no option to specify the value for that property.
Can any one suggest me a control for it.
Thanks in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: here is no option to specify the value for that property.
you mean, SelectedIndex??
M. J. Jaya Chitra wrote: is there any other option to bound the display value and the item value separately.
Can you tell us more about what you wanna do?
|
|
|
|
|
My target is to bind the description and the id of that description to a combo box.
For this now I have found one solution to use the "ValueMember" property.
Thanks for you time.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
cool...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
hi iam in a little bit of confusion how to add webreferences dynamically in .net can anybody helps me
|
|
|
|
|
If you add a web reference allready in your application then set its property to Dynamic. After that Suppose on a button's click write this
Myref is the service name Ok. And client is a object of that.
Myref.MyRef client = new Myref.MyRef();
client.Url = "Web reference URL"; //put new URL here.
client.Methodname(parameters);
Hope this helps
-- modified at 3:53 Monday 12th November, 2007
Regards
Pankaj Joshi
|
|
|
|
|
How can i show all the images of a given folder and show them as long as the application is running?
I would like them to be organized by name and show in the full form...
Best regards,
Luis E Tineo S
|
|
|
|
|
like slideshow?
if yes then use Timer
Becoming Programmer...
|
|
|
|
|
|
why are you making a seperate picturebox for every picture
use only one that will be easy and good
Becoming Programmer...
|
|
|
|
|
Because i need to know what picture was choosen... to pull some data out of it!!!
Luis E Tineo S
|
|
|
|
|
so it not compulsary to make seperate pictureboxes
while loading picture, give its path or file name to a label or a string
and when picturebox clicked, you will know about the picture
Becoming Programmer...
|
|
|
|
|
the best way which i think is that storing all the images with similar sequential name like 1.jpeg,2.jpeg...
then take a pic box n a timer so in the form load function write something like this
picbox.backgroundimage = image.fromfile("c:\\" + i ".jpeg");
i = i+1;
run a timer which repeats the above function
i hope this will work as i have done it before
its me sid
|
|
|
|
|
It makes a lot of sense but how can i create the different picturebox for each pic, because even if i have the timer at 10 miliseconds it will always be the same and if i am calling a method from it, it will always call the same method?
I need to create different pictureBox because i will have a touchscreen where end users will select picture they like the most.
So to a given folder containing the pics i will give it a picture for each pic to make sure i control all pictures.
My problem is that i can be given 2 pictures but i also can be given 100 pictures...
Thanks... a lot!!
Luis E Tineo S
|
|
|
|
|
I dont have much idea but a clue i hope it works
step 1. take a pic box array
2. Count the no of pics in the folder
3. now run a loop to show the pic boxes as accordint to no of pics
4. Assign proper top n left values to the pic boxes
i hope this will be useful ...any way nice question 4m u
its me sid
|
|
|
|