|
Hi all,
I hope you can help me with the following problem:
I have a third party COM Object written in c++.
I have a VS 2003 C# Project (1.1) that accesses this object (via "Add Refernence To Com Object...")
Everything works fine!!!!
Now I want to access the COM Object from a C# VS2008 Project (3.5).
In the VS2008 project I get an Exception saying that it is not possible to cast the Object
to the desired type. The functions only return __ComObject.
I tried Marshal.CreateWrapperOfType(), but no success.
Do you have any idea what I can do??
Thanks in advance
Jens
modified on Wednesday, October 22, 2008 12:14 PM
|
|
|
|
|
Hi all .
I Wount to Learn Shair Point , But I do Research On the Enter Net About Books For Shair Point ,
But I dont Found Free Books About it .
Who Can Give Me Address For Web Application Allow To me Download Books About it ?
Thanks For Any body heelp me
Thaer
|
|
|
|
|
Hi,
a quick google search came up with a blog entry about a free sharepoint eBook:
Click here
regards
Sebastian
|
|
|
|
|
Hi all,
I need help in converting a delimited text file as follow into a database file so that i could use sql commend to select and view the column that i wants to view. but i am stuck in converting the file pls help, i am using 2005 C# for my programming.
My delimited text file:
Time Locked CBER Quality VBER Strength SNR Uncorrectable
03:08:45.655 T 1.0E-003 64 1.6E-003 -17 18 1143
.655 col start @ 1st tab
Locked col start @ 2nd tab
CBER col start @ 3th tab
Quality col start @ 5th tab
VBER col start @ 7th tab
Strength col start @ 9th tab
SNR col start @ 11th tab
Uncorrectable col start @ 12th tab
the tab mean the delimited spacing of each column within a row. Pls direct me if i m wrong, what i need is to convert this file into a database file for better storing and selection to view the col of info i want thanks.
|
|
|
|
|
Hi,
so you already made half of the way. If you know the format of the file, so what's left is:
1) Read the file line by line.
2) Split each line (could be done with line.Split('\t')) to get an array corresponding to your columns.
3) Put the values in a sql command and execute it.
Oh missed point 0) Set up the database.
Regards,
Sebastian
|
|
|
|
|
Some databases support this operation. You should consult your database documentation. In SQL Server they have Bulk Insert[^]
led mike
|
|
|
|
|
That mean i need to create a table? sorry i am new in C# programming
|
|
|
|
|
Hook up!!!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hmm. Getting replies today that I just don't understand. Guess I picked a bad day to stop smoking crack.
led mike
|
|
|
|
|
We've discussed this before...."Hook up!" is yelled when a big game fish
(tuna, yellowtail, wahoo, etc.) grabs a lure while trolling from a sportfishing
boat.
Judging by the OP's reply above, you've been hooked
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: We've discussed this before...."Hook up!"
Ah yes, now I remember. At least now I understand your reply.
led mike
|
|
|
|
|
A simple newbie question about interfaces if I may.. Should I be able to do the following:
ClassA classA = new ClassA();
IClass iclass = (IClass)classA;
ClassB classB = (ClassB)iclass;
Assuming both ClassA and ClassB implement IClass. I get an InvalidCastException (which may answer my question) but thought I should be able to do it? Thanks
|
|
|
|
|
Hi,
well I think this is not working because the iclass-reference points to an ClassA object and not to an ClassB object. So it's correct that you get an InvalidCastException.
Was this helpful?
Regards
Sebastian
|
|
|
|
|
No you shouldn't.
I'll go through your code line by line and explain what is happening.
This line creates a new object of type ClassA and assigns it to the classA variable
ClassA classA = new ClassA();
This line takes that ClassA object and casts it into a IClass type variable. Note that the object itself is still a ClassA object, it's just being stored in a variable that is IClass
IClass iclass = (IClass)classA; Now you have an IClass object, you can only call methods on it that are part of that interface. You can't call ClassA specific methods on it, but it is still a ClassA object, so when you call those IClass methods, they are routed to the ClassA definitions for execution.
What you are trying to do here is cast an IClass object as a ClassB object. but the object isn't of type ClassB, it's of type ClassA, so the cast fails
ClassB classB = (ClassB)iclass;
This would work, because the object is a ClassA object, so can be cast as such.
ClassA aAgain = (ClassA)iclass; What your doing is like taking an apple, putting it in a box that is labelled "fruit", then trying to take the apple back out of the box and claim it is now an orange. Casting doesn't ever actually change the underlying type.
By the way, you don't actually need the first cast. because ClassA already inherits from IClass, you can just do the assignment without casting
IClass iclass = classA;
Simon
|
|
|
|
|
I like this one:
Simon Stevens wrote: What your doing is like taking an apple, putting it in a box that is labelled "fruit", then trying to take the apple back out of the box and claim it is now an orange.
Should remember this for next time explaining casts...
|
|
|
|
|
how to edit appconfig in windows application(C#)??
i am using this code but not getting success please help me
Code:-
Properties.Settings.Default.DestinationDrives = "ppc";
Properties.Settings.Default.Save();
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
That code looks correct. What is the problem?
(Note that when you save user scope settings they aren't saved back to the app.config file, they are saved in the users local settings directory. If you close and reopen your app, you will find when you load the settings they will load correctly with the changed values)
Simon
|
|
|
|
|
...
Blog link to be reinstated at a later date.
|
|
|
|
|
How can i check in Run Time if in current machine that execute my application (exe file) has an active microphone ?
|
|
|
|
|
You can't detect if a microphone is physically connected or not. What you could do is monitor the sound levels and see if there is something coming in on the input.
Simon
|
|
|
|
|
Good Afternoon All
I dont know if am asking this in a Correct way Purdon me if i dont. I have a Help file that gets opened with "Windows Winhlp32 Stub. i need to Call this in C#, in my Menu, when a User Clicks Help it should Show this Menu. I have attached the Examples. How can i call this Files in C#.
http://www.vbforums.com/attachment.php?attachmentid=67180&stc=1&d=1224678042[^]"> Example
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I have a foreach loop i want to write on one line of code. does anyone know a "one-Liner" for this. This must be fairly common but i havent found any.
List<animals> animals = (Fill list somehow...)
List<int> teeths = new List<int>();
foreach(Animal a in animals)
{
teeths.Add(a.TeethCount);
}
//i want Something like this:
List<int> teeths = animals.ExtractPropertyList(delegate(Animal ani){"return all Teeths"});
Anyone?
|
|
|
|
|
List<int> teeths = animals.ConvertAll<int>(delegate(Animal animal) { return animal.TeethCount; });
|
|
|
|
|
good stuff.
Exactly what i wanted.
|
|
|
|
|
If you use .Net 3.5 you can also do a LINQ query like this:
List<int> teeths = (from animal in animals select animal.TeethCount).ToList();
or (the behavior is the same):
List<int> teeths = animals.Select(animal => animal.TeethCount).ToList();
modified on Wednesday, October 22, 2008 8:21 AM
|
|
|
|