|
Ariadne wrote: Object-Browser. both show only PW and not Convert5Bit()
Well, in that object browser the method should be under the class name, shouldn't it? I mean you access the method by the class name? Also what file did you look into using the notepad?
Ariadne wrote: 3rd it tried that, but no success.
Define "no success"? You can't instantiate the object from the exposed class? Or the instance can't access the member function?
Regards
|
|
|
|
|
Nader Elshehabi wrote: Also what file did you look into using the notepad?
I opened the tlb-File with notepad: There was no Convert5Bit.
Nader Elshehabi wrote: object browser the method should be under the class name
Under the class name is no method.
If I instantiate the class I get an runtime error: 429 ActiveX component can't create object.
But VBA knows the class PW.
Ariadne
|
|
|
|
|
Well, I haven't tested the issue thoroughly. I did some googling and found this post on MSDN forum
Post link[^]
and here are two more articles in MSDN about the issue:
Article 1[^]
Article 2[^]
Also I did what I told you. I made a tlb from the .Net dll, and it actually references to the class and the methods inside the class!! About the instantiation errer; Did you make your constructor public?
I hope this directs you somewhere. Good luck! And I'm waiting for your feedback.
Regards
|
|
|
|
|
Thanks for your articles.
I read a lot of stuff too.
But it seams there is something basic wrong.
here the story, what I try:
1. I build a classlibrary-project in VS8 C#.
2. I insert one TestDLL class:
using System;
using System.Collections.Generic;
using System.Text;
public class TestDLL
{
public string StringChange(string str)
{
return str +" from C#";
}
}
3. I build the project with a TestDLL.dll as result
4. I run tlbexp TestDLL.dll /win 32 /out:TestDLL.tlb
5. An inspection of TestDLL.tlb with notepad.exe shows no StringChange string.
6. I run regasm TestDLL.dll
It returns a waring: RA00000 : there are no types registered (retranslation from german)
7. I tested the same on a virgin VS8 Enviroment on my home notebook with the same result.
8. I have no idea....
Ariadne
|
|
|
|
|
That's it: in assemblyinfo.cs there is a switch:
[assembly: ComVisible(true)]
but it was false
Now all works fine...
Thank you for your support Nader
Ariadne
|
|
|
|
|
VBA does not support static functions.
Also, you are confusing Declare with COM.
To get at an exposed COM object in VBA, ad a reference to it, then instansiate the class.
Declare Function has nothing to do with COM - it uses access points, which cannot be created from C#.
To create an access point, use an MFC dll.
Schabse S. Laks
|
|
|
|
|
i have 3 projects in my .sln file.
1 - webproject (vb.net), 2 vb.net class library(Schemas) 3. c# class library (Managers).
i am passing Schemas object from code behind of web project to a method of Managers class.
it is giving an error as
"Reference required to assembly 'Schemas' containing the type 'Schemas.mySchemas'. Add one to your project."
All the references correct.
current references :
webproject having ref. to Schemas and Managers prjs
Managers having ref. to Schemas prj.
Please suggest me how to go about this issue.
Thank you inadvance.
-- modified at 1:25 Thursday 26th October, 2006
PradeepG
|
|
|
|
|
Hi,
if your passing an object of one of the Schema classes to a Managers class than Managers also needs a reference to Schemas . The fact that webproject passed it over doesn't matter in this context.
Robert
|
|
|
|
|
Hi Robert,
Managers class also having a reference to 'Schemas'
This problem is giving when i am passing a vb.net class object to a c# class method.
It was working for vb.net class object to a vb.net class method.
Problem is peculiar
PradeepG
|
|
|
|
|
pdeep wrote: Managers class also having a reference to 'Schemas'
So it won't allow you to create a reference because then you'd end up with a circular reference.
This generally indicates that there is something wrong with the design. You may like to refactor your classes to remove the circular reference between assemblies. Either by putting all the classes in one assembly, or defining more clearly the boundaries between assemblies.
[ADDITIONAL]
The problem has nothing to do with whether the code was written in C# or VB.NER - it is all to do with which assembly the code is in.
[/ADDITIONAL]
|
|
|
|
|
Colin Angus Mackay wrote: The problem has nothing to do with whether the code was written in C# or VB.NER - it is all to do with which assembly the code is in.
Nice typo! I first read: VB.NERD
Robert
|
|
|
|
|
I have a dataset that loads an xml file. What i'm wanting to do is load each row into an array. each row has 9 elements. When i try to loop through the item array for that row i get a null reference. I'm not sure of an easier way of doing it. Could someone help me out please?
DataSet ds = new DataSet();
ds.ReadXml(filePath);
foreach (DataRow r in ds.Tables[0].Rows)
{
for (int d = 0; d <= 8; d++)
{
xmldata[d] = r.ItemArray[d].ToString();
}
}
When i ran through the debugger i did verifiy that r.ItemArray[d] did have a string in there.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi,
hard to say. Generally there shouldn't be null values in the rows (only DBNulls).
Are you sure you have you have initialized xmldata correctly?
string[] xmldata = new string[9];
Robert
|
|
|
|
|
Are you defining the array xmldata? Is it large enough to hold 8 items? You can try adding items to an arraylist and then convert that to an array.
I know this is example code, but as read, xmldata will hold the items for the last row in the DB when it exits the loop.
|
|
|
|
|
yeah i am defining a string array without a limit to hold items:
string[] xmldata;
What i'm wanting to do is load an xml into an array then edit the array then once satisfied with the array i am going to write the array into an xml document. When i directly load the listview it loads properly with the code below
private void Load_Xml()
{
DataSet ds = new DataSet();
ds.ReadXml(filePath);
foreach (DataRow r in ds.Tables[0].Rows)
{
ListViewItem lvindex = new ListViewItem(r.ItemArray[0].ToString());
ListViewItem.ListViewSubItem sublvindex = new ListViewItem.ListViewSubItem(lvindex, r.ItemArray[1].ToString());
lvindex.SubItems.Add(sublvindex);
sublvindex = new ListViewItem.ListViewSubItem(lvindex, r.ItemArray[2].ToString());
lvindex.SubItems.Add(sublvindex);
lv_xmlList.Items.Add(lvindex);
}
}
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Ok, where are you assigning items to the array (the problem)?
|
|
|
|
|
Hi, i'm learning to program using c# and i'd like to know how can i access to the windows from the taskbar, and make operations with them like hide them, close them all or close just a program and stuff like that.
Thx very much =)
|
|
|
|
|
hi,
Why don't u do some reading and then ask some serious and clear questions. cause no body can give u a lecture in c# on a discussion board.
THis board is for discussion not for lectures
Jamil Abou Khalil
|
|
|
|
|
The taskbar has nothing to do with it. If you want to manipulate other windows currently running, you'd have to send them messages. This can be done in C# indirectly using windows API calls. The messages you'd look for would start with WM_, short for "Windows Message". The functions you'd use to send these messages are PostMessage() and SendMessage() . I'll let you kmnow the difference from your MSDN.
Look for P/Invoke section in C# articles page. You'd find some useful articles on how to call the above functions from your C# code.
Regards
|
|
|
|
|
hey, hope somebody can help me on this... i need to read all the files from a cd... how should i start?.. is that can be done in c++ or c#?
|
|
|
|
|
|
Iv01 wrote: i need to read all the files from a cd
Define "read"? Read them as binary, text, hex, etc... or just copy them somewhere else?
Iv01 wrote: how should i start?
By making yourself clear first I guess. Also have you done some reading in the article section first?
Iv01 wrote: is that can be done in c++ or c#?
File IO can be done in any language. C# isn't that weak or God sake!!
Regards
|
|
|
|
|
I am trying to insert an item at a specific index. However it puts the new item at the end of the list. Not where it is needed.
There is only one exception to this. If I switch the view to 'list' it puts the item in the correct place.
Does the 'Items.Insert(5, lvitem)' command only work when in the 'list' view? If so, what is the best way of ordering items and adding items where I would like them to be put?
Thanks in advance,
Phil
"Rules are for the obedience of fools and the guidance of wise men"
|
|
|
|
|
Phillip Hodges wrote: Does the 'Items.Insert(5, lvitem)' command only work when in the 'list' view?
No, but the behavior is effected by having more than one "group". I was researching this but never got back to it. My next phase was going to look at using the "group" interface for inserting.
led mike
|
|
|
|
|
Thanks for that... Will look into it...
Phil
"Rules are for the obedience of fools and the guidance of wise men"
|
|
|
|