473,320 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

converting c# to COM

I have to create a COM dll from c# to use within old code. Every time I build
I get a new guid. I have tried to use the [Guid(...)] phrase before a class
or interface, but the compiler won't build due to the following messages:

Syntax error, ']' expected (shown after "[Guid" and before "("
A namespace does not directly contain members such as fields or methods
Type or namespace definition, or end-of-file expected
My code looks like:

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace EvalAndReview
{
/// <summary>
/// Summary description for SpectCharts.
/// </summary>
///
// interface
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid{"1D99B653-4AD4-41c6-9D0F-46C366FB43A6"}]
public interface IDataReviewCharts
{
void ClearChart (int chart);
void SetRawSpectrumPointlist (int curve, int size);
void SetBGSubSpectrumPointlist (int curve, int size);
void SetLibSpectrumPointlist (int curve, int size);
void LoadRawSpectrumPoint (double x, double y);
void LoadBGSubSpectrumPoint (double x, double y);
void LoadLibSpectrumPoint (double x, double y);
}
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid{"1D99B653-4AD4-41c6-9D0F-46C366FB43A6"}]
public class DataReviewCharts : System.Windows.Forms.Form
{
...
}

Any help in getting this to build will be greatly appreciated.
Thanks
Nov 16 '05 #1
3 1135
woodworker wrote:
[Guid{"1D99B653-4AD4-41c6-9D0F-46C366FB43A6"}]


Try

[Guid("1D99B653-4AD4-41c6-9D0F-46C366FB43A6")]

The [] attribute syntax is a sort of shorthand for

new GuidAttribute("1D99B653-4AD4-41c6-9D0F-46C366FB43A6");
--

www.midnightbeach.com
Nov 16 '05 #2
Jon,

Not to bust chops, but it's not shorthand for "new <attribute type>",
just for the name of the type. You can't do this, for example:

new GuidAttribute("1D99B653-4AD4-41c6-9D0F-46C366FB43A6");
public class MyClass
{
...
}

It won't compile.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Jon Shemitz" <jo*@midnightbeach.com> wrote in message
news:41***************@midnightbeach.com...
woodworker wrote:
[Guid{"1D99B653-4AD4-41c6-9D0F-46C366FB43A6"}]


Try

[Guid("1D99B653-4AD4-41c6-9D0F-46C366FB43A6")]

The [] attribute syntax is a sort of shorthand for

new GuidAttribute("1D99B653-4AD4-41c6-9D0F-46C366FB43A6");
--

www.midnightbeach.com

Nov 16 '05 #3
"Nicholas Paldino [.NET/C# MVP]" wrote:
The [] attribute syntax is a sort of shorthand for

new GuidAttribute("1D99B653-4AD4-41c6-9D0F-46C366FB43A6");
Not to bust chops, but it's not shorthand for "new <attribute type>",
just for the name of the type. You can't do this, for example:

new GuidAttribute("1D99B653-4AD4-41c6-9D0F-46C366FB43A6");
public class MyClass


I know, that's why I said "sort of" - I was just trying to make it a
little clearer why the [Guid{"1D99B653-4AD4-41c6-9D0F-46C366FB43A6"}]
syntax didn't work.
--

www.midnightbeach.com
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mustafa | last post by:
Dear sir , I have built my application in visual basic 6.0 and crystal Report8.5 , Now i migrated my application to VB.net using the upgrade wizard.My visual basic form is upgraded to vb.net...
29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
by: Mary | last post by:
Hi, Does anyone know of any software out there that would convert an application written in VBScript to either VB.NET or C#/C++ quite quickly for me, or will I have to re-write the application...
2
by: Map Reader | last post by:
Greetings, I am converting an old VB6 application to use .NET. One of the old controls loads icons from the disk and displays them. However, the transparent color turns to blue somewhere in the...
12
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
7
by: Tor Aadnevik | last post by:
Hi, I have a problem converting values from Single to double. eg. When the Single value 12.19 is converted to double, the result is 12.1899995803833. Anyone know how to avoid this? Regards...
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.