|
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"
|
|
|
|
|
Phil, I went back to work on that project and got groups working. How are you doing with it?
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
|
|
|
|
|
I'm using a textbox to display a short running buffer for character data with new data being appended to the right of the string and old values falling off the left end. I'm measuring the length of the string in pixels to determine if I need to remove characters from the front to make it fit. The issue I have is that I can only get the total width of the textbox, not the width of the area available to display text within it. Is there any way I can get that value for use directly instead of coding in a magic number that appears to work for all testcases?
Graphics g = TheTextBox.CreateGraphics();
while (g.MeasureString(theString,TheTextBox.Font).Width >this.TheTextBox.Width -5)
theString = theString.Remove(0,1);
|
|
|
|
|
dan neely wrote: Is there any way I can get that value for use directly instead of coding in a magic number that appears to work for all testcases?
They hide that information in the documentation[^]
led mike
|
|
|
|
|
How do I perform a binary search on an array with a struct type?
Lets say I have this as my struct:
[StructLayout(LayoutKind.Explicit, Pack=1)]
public struct allInfo
{
[FieldOffset(0)] public byte rating;
[FieldOffset(1)]public ushort movieId;
[FieldOffset(3)]public uint id;
}
The I have an array:
allInfo[] example = new allInfo[100];
How do I do a binary search just for movieId?
I want to do something like:
loc = Array.BinarySearch(example, mId);
where loc is the index of the element in array example where example[loc].movieId = mId
|
|
|
|
|
You create a custom comparer for the structure and use the overload for BinarySearch where you can specify a comparer.
---
b { font-weight: normal; }
|
|
|
|