|
I meant, using COM Interop I have imported the .C# component to COM component. These are the steps to create the COM Interop component in C#
1. Create a class library or windows control library project.
2. Add the required methods.
3. Goto Project-> Propeties and select Build
4. Check Register for COM Interop option
5. Compile the project
6. use the regasm.exe utility to register create type library and register the components with /codebase switch
(ex : >regasm mycontrol.dll /tlb:mycontrol.tlb /codebase
7. Now the assembly is registered in your system.
8. Open the vb project and add reference for this component.
9. Now you can access the .NET component in vb6 as if you access other components.
Thanks
Sivakumar R
|
|
|
|
|
Thanks for the reply.
I followed your steps and was able to create the COM; however, I can't see any of the methods of my COM object in VB6. I can only see the class.
In vb.net this happened if I didn't declare the COMClass attribute which specifies the GUIDs for classId, interfaceId, and eventsId. Don't I need the same in C#?
Thanks,
Rudy.
|
|
|
|
|
Hello,
I get an exception when press Ctrl+C in my DataGrid, however, if I right click the grid, and pick Copy from a menu, everything works fine. Any ideas? Here is the exception:
The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
************** Exception Text **************
System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy)
at System.Windows.Forms.Clipboard.SetDataObject(Object data)
at System.Windows.Forms.DataGrid.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG& msg)
|
|
|
|
|
I may be waaaay out in left field here, but have you tried applying the STAThreadAttribute to your Main function?
|
|
|
|
|
|
And you still get the error? Does it error on all types of cell data?
|
|
|
|
|
Yeah I still get the error, by the way do you place STAThreadAttribute before all your methods in the class?
|
|
|
|
|
should just be as follows:
[STAThread]
public static void Main(...
or
[STAThreadAttribute]
public static void Main(string[] args)
If the clr is initializing COM before your main is called, or you're firing off your form in a newly created thread, it may not work correctly.
|
|
|
|
|
Hello gurus,
I would like to know how to find and activate or (re)open a document in an MDI application by double clicking on the tree leaf?
I have stored the document's path in a treeview and when selecting a leaf that correspond to the document, I wish to activate the window if it's already opened or (re)open it if necessary by double clicking the leaf (how to detect that properly?). See what I mean? If so, how to do that?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
if all you need that if the document was just activate it and ifnot open new one
you can store the value of opened document (paths) in your case into hashtable when the user click treenode chech the path if found just activet it if not open it
and don't forget to remove this value from hashtable when
you close the document
Or your question about how to open and activate the document?
MCAD
|
|
|
|
|
Hello,
I guess you know VS .NET... When you double click on a file name via the Solution Explorer, if the document is already opened, the IDE put the window to the front. If the document is not opened, the IDE opens it. When you select an opened document, the IDE actializes the Solution Explorer and selects the correct leaf to reflect which document has been brought to front.
I wish to do a similar behaviour in my application. My application handles several types of documents. I wish to build the same behaviour as VS .NET: when I double click on the treeview leaf, it opens the document if it does not exists or brigs it to front if it exists. If we select an mdi child, it actualizes the treeview. See what I want to do?
How to code this???
Fred.
There is no spoon.
|
|
|
|
|
He told you how to do that in his previous post - use whatever your criteria is for document uniqueness (i.e. path) as a key in a hashtable with the value being a reference to your mdi kid. When the abuser clicks on one of your leafs, check the hashtable for the existance of the key, if a value is found, make sure it's still valid, then call that mdi child form to the front, otherwise create a new mdi child as normal then register it in your hashtable.
|
|
|
|
|
As I said to you use hashtable to demonstrate this
in case you have treeview and tabcontrol like VS
it acttually not standerd tab but no problem
You can easly modify this to work with forms instead of tabcontrol and tabpages
HashTable ht=null;
and in form load event you init the Hashtable
ht=new HashTable(); ;
now suppose the user double click on tree view
if the tabcontrol have tabpage select it if not add new one
private void treeView1_DoubleClick(object sender, System.EventArgs e)
{
if(ht.Contains(treeView1.SelectedNode.Text))
{
tabControl1.SelectedTab=(TabPage)ht[treeView1.SelectedNode.Text];
}
else
{
TabPage newTab=new TabPage();
newTab.Text=treeView1.SelectedNode.Text;
tabControl1.TabPages.Add(newTab);
ht.Add(treeView1.SelectedNode.Text,newTab);
}
}
MCAD
|
|
|
|
|
Thanks
I have found that way:
<br />
private bool FindChild(string caption)<br />
{<br />
foreach (Form frm in MdiChildren)<br />
if (frm.Text == caption)<br />
{<br />
frm.BringToFront();<br />
return true;<br />
}<br />
return false;<br />
}<br />
Is it valuable? At least, it works fine too
Fred.
There is no spoon.
|
|
|
|
|
How can i set a value to a property of an object inheritant MarshalByRefObj at client side
|
|
|
|
|
Nothing special you need to do, just set the property as you would if you had a reference to the actual object.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hii all;
i got a serious problem. i return an xml file in a string from web service. when its serialized the xml serializer replaces tages '<' with its unicode &.. which make a problem to me.
how can i force the serializer to make some how my xml string const ,commented and don't change tages.
by the way i don't want change values to tages again with my own i wanted to be back as tages.
Thanks in advance.
marcoryos
|
|
|
|
|
You mean that the data is html encoded? "<tag>" turns into "<tag>"?
This is obviously needed if you put an xml document as data inside another xml document, as web services use xml to send the data.
When the soap message is parsed the data will be restored to it's original state.
---
b { font-weight: normal; }
|
|
|
|
|
yes but the problem is when i got the data back
i don't wanna parse it i wanna save it as its on xml file. The destenation program written in c standard so i have to change the the codes by my self into tages which headach i don't want to. is there any way to transfer file without allowing soap serializer to do soo. i tried to comment xml tages and use CDATA but it changes to
marcoryos
|
|
|
|
|
If you don't want to parse the response, just save it as it is. But you won't get the data from the response before you parse it.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
I have a question.
Any value type variable is allocated on Stack and Any reference type variable is allocated on Heap. Now lets say i have a class defined as:
class Box
{
int a;
int b;
int c;
...
}
Now somewhere in the code it is written,
Box myBox = new Box();
Now obviously myBox object is created on Heap.
My Question is where the variables 'a', 'b', 'c' has been created, on Stack or on Heap???
Chiranjib
|
|
|
|
|
They are created inside the object, in the heap.
---
b { font-weight: normal; }
|
|
|
|
|
ChiranjibC wrote:
Any value type variable is allocated on Stack and Any reference type variable is allocated on Heap.
No, the correct would be saying "Any value type local variable or method argument is allocated on Stack and Any reference type variable is allocated on Heap.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Hi
In my project there is a option for news letters. I want to check that the E-mail IDs enter by the users exists or not .How can I do this using C#.
Thanks in Advanced
Alok
Alok
|
|
|
|
|
The System.Networking.Messaging.EmailVerification class, of course! It has a static method, "Verify" that will tell you whether any text string is a valid, active email address. It doesn't even have to access the internet to do so - amazing bit of code actually.
|
|
|
|