|
Hi everybody i got a problem in DLL and COM interoperability so could some one help me please !!!
I want to create a COM object in C# called conversion.dll
So I begin by creating Class Library project called “conversion.dll”
1-I add reference to a COM Object called “devise.dll”
2-When i compile the project a wrapper is created by VS.NET called “Interop.devise.dll”
3-i compile in VS.NET no problem and that’s great!!!
3-but to create the COM object conversion as I know i must add a key file called “conversion.snk”
So to create the file I go to prompt
Sn –k conversion.dll
5-i edit the file AssemblyInfo.cs in my project by adding
[assembly: AssemblyKeyFile("conversion.snk")]
6-I compile boooooom !! an error was generated
Message the assembly Interop.devise referenced is not a strong name !!!!!!
So how can I process to create the COM object conversion.dll knowing that the COM object devise.dll is alredy existing in the client Side..
Thank you in advance!!!!
|
|
|
|
|
You no need to add key file unless it is to be put in Global Assembly Cache. In the command prompt you just move to your project folder and then to bin\debug. Type the following in the command prompt
>regasm <yourcom>.dll /tlb:<tlbfilename.tlb> /codebase
Here the /codebase switch is important. It will set the code base in the registry.
Now, you will be able to access the component in com client.
|
|
|
|
|
Hi, i need regular expression to validate the hour, what i need is a format like this: 08:00:00 (hours, minutes and seconds). Im using this formatting but its not working, any ideas??
strFormat = @"^\d{2}\:\d{2}\:\d{2}\$";
thanks in advance...
|
|
|
|
|
You have escaped your "end of string" marker. Take out the "\" before the $ and it should match.
|
|
|
|
|
one another thing this pattern will match somthing like
80:90:95 because you din't specify the range
for valid hour,minuts,seconds
MCAD
|
|
|
|
|
Thats true, how can i define the range then?
thanks in advance....
|
|
|
|
|
\d{2}:[0-5]\d:[0-5]\d
That should do the trick. Max time will be then 99:59:59
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Here you go
^(?<Hour>[0-1]\d|[2][0-3])(?: (?<Minutes>[0-5]\d)(?: (?<Seconds>[0-5]\d)
Puts it into nice groups of Hour Minutes and Seconds. If it doesn't match it is not valid. It is based on a 24 hour clock.
23:59:59 valid but
24:00:00 is not
|
|
|
|
|
Hi Everyone,
Again I am posting my problem.
I am working on DataGrid. Actually I have relationship between two table(Customers and orders) and
displaying on DataGrid. I want to update a record of orders table when I click or select on one datagrid row,
all the records of one row (order table) goes to Textbox control one by one then I or user can update the table easily. Actually then I will have orderID in textbox control.
Thanks
|
|
|
|
|
Hello,
Is there a way of setting the Allignment to Center for the HeaderText for all of my Columns in the datagrid.
Thank you
|
|
|
|
|
The DataGridColumnStyle has an "Alignment" property that you can set to HorizontalAlignment.Center.
|
|
|
|
|
I can't find it. I have:
this.styleStages.GridColumnStyles["ColumnName"]
ColumnName has allignment property, but that will allign the data inside the cells, and not the header. Am I looking in the wrong place?
Thank you
|
|
|
|
|
Humm, that's interesting. I guess setting the alignment after adding a TableStyle then only sets alignment of the data.
Anyway, when I tested on my datagrid I did the testing during the creation of the TableStyle.
Example:
<br />
private void CreateGrid()<br />
{<br />
DataGridTableStyle ts = new DataGridTableStyle();<br />
ts.MappingName = "TableName";<br />
<br />
DataGridTextBoxColumn textCol = new DataGridTextBoxColumn();<br />
textCol.MappingName = "ColumnName";<br />
textCol.HeaderText = "Test Column";<br />
textCol.Alignment = HorizontalAlignment.Center; <<-- Set alignment here<br />
ts.GridColumnStyles.Add(textCol);<br />
<br />
myGrid.TableStyles.Add(ts);<br />
}<br />
|
|
|
|
|
I've got a set of xml files which all look similar to this one:
<?xml version="1.0" encoding="utf-8" ?>
<designs>
<item>
<title>Standard</title>
<description>Das Standard Layout.</description>
<stylesheetname>default.css</stylesheetname>
<imageurl>standard.jpg</imageurl>
</item>
<item>
<title>Text Version</title>
<description>Das Leichtgewicht.</description>
<stylesheetname>textonly.css</stylesheetname>
<imageurl>textonly.jpg</imageurl>
</item>
</designs>
The number of item elements varies. What is the easiest way to loop through the xml and extract the individual data items? I had a look at the XmlTextReader but the methods provided in this class seem a bit cumbersum. There must be an easier way...
Any help is greatly appreciated.
/matthias
|
|
|
|
|
Try using XPath
XmlDocument document = new XmlDocument();
document.Load(filename);
XmlNodeList nodes = document.SelectNodes("designs/item");
foreach(XmlNode node in nodes)
{
...
}
something like that should go through the nodes...
|
|
|
|
|
Here is a simple process the goes through an entire XML file regardless of definition.
XmlTextReader reader = new XmlTextReader(@"..\..\test.xml");
try
{
while (!reader.EOF && reader.NodeType != System.Xml.XmlNodeType.Element)
{
BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value );
reader.Read();
}
if (reader.EOF)
{
reader.Close();
results.Items.Add("End of file process");
return;
}
}
catch (System.Exception exc)
{
results.Items.Add(exc.Message);
if (exc.InnerException != null)
results.Items.Add(exc.InnerException.Message);
return;
}
int currentDepth = reader.Depth;
DoAttributes(reader);
do
{
if (reader.NodeType == System.Xml.XmlNodeType.Element)
{
results.Items.Add(BuildLine( reader, "Element", reader.Name, reader.Value ));
if (reader.AttributeCount > 0)
{
DoAttributes(reader);
}
reader.Read();
}
else
{
results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value ));
reader.Read();
}
} while (!reader.EOF
&& !((reader.NodeType == System.Xml.XmlNodeType.EndElement
|| reader.NodeType == System.Xml.XmlNodeType.Element)
&& reader.Depth <= currentDepth));
...
private void DoAttributes(XmlTextReader reader)
{
results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value ));
if (reader.MoveToFirstAttribute())
{
do
{
results.Items.Add(BuildLine( reader, "Attribute", reader.Name, reader.Value ));
}while(reader.MoveToNextAttribute());
}
}
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Both the suggestions submitted are good.
If you want a good tutorial on working with XML try Here and look for Lesson 10: Working with XML
(NB: The Tutorial is for Visual C# 2005 Express)
|
|
|
|
|
need a way to connect flash with C# program or photoshop
|
|
|
|
|
|
Where is this usually goes within your class? Do I place it before all of my methods< and it will affect all of them?
Thank you
|
|
|
|
|
|
Hi all,
My program is using MS WORD in automation (unvisible). Sometimes, in a case of failure WORD stays active in memory. I think I will find a solution in this forum to kill WORD in the tasklist (I have seen somethink here) but how can I prevent to kill a version wich I have not created by my program.
(I already hear the cusomer crying - where is my text)
Who can solve my problem
Thanks alot
Frank
|
|
|
|
|
This should do it
private int _WordAppProcessID= 0;
[DllImport("user32.dll", EntryPoint="GetWindowThreadProcessId")]
public static extern uint GetWindowThreadProcessId(int Hwnd, ref int ProcessID);
GetWindowThreadProcessId(this._WordApp.Hwnd, ref this._WordAppProcessID);
KillExcelInstance();
internal bool KillExcelInstance()
{
// Kill our instance of Excel...
if (this._ImportExcelProcessID != 0)
{
Process.GetProcessById(this._WordAppProcessID).Kill();
return true;
}
return false;
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
Thank you,
it seems to be the right way...
but I have the problem that _wordAPP derieved from Word.ApplicationClass() has no Hwnd. Do you know
where to get it ?
Thanks
Frank
|
|
|
|
|
Hi
How can i create an exe file written in C# which is not depends on the .Net Framework?
I want to run this program without any installation - a standalone exe.
I think that i'll get this goal using windows API programming but i'm not sure and i didn't find any good reference that teach me how to do this.
Am i right? do you have any idea how can i start doing it?
Thanks a lot
Mamtz
|
|
|
|