Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Code Conversion with a GUID

Posted on 2005-02-28
12
Medium Priority
?
707 Views
Last Modified: 2008-03-03
Hey

I am trying to convert the following code from c# to vb and I keep getting this error...

Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.

Does anyone know how to convert it?

using System;
using System.ComponentModel;
using System.Windows.Forms;

using BandObjectLib;
using System.Runtime.InteropServices;

namespace SampleBars
{
      [Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")]
      [BandObject("Hello World Bar", BandObjectStyle.Horizontal | BandObjectStyle.ExplorerToolbar | BandObjectStyle.TaskbarToolBar, HelpText = "Shows bar that says hello.")]
      public class HelloWorldBar : BandObject
      {
            ......
        }
}


Thanks
0
Comment
Question by:NickOlsen
  • 5
  • 4
  • 2
11 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 13427542
In VB class attributes must be in the same line as class declaration or you need to use _ symbol to define them in different line:

[class attributes] _
public class HelloWorldBar
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 13427556
For example:

<GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")> _
Public Class SampleClass
   ...
End Class
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13428922
For the code snippet:

Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports BandObjectLib
Imports System.Runtime.InteropServices

Namespace SampleBars

 <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
 <BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar Or  
   BandObjectStyle.TaskbarToolBarHelpText="Shows bar that says hello.")> _
 Public Class HelloWorldBar : Inherits BandObject
 End Class

End Namespace

Bob
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:NickOlsen
ID: 13430153
If I do this...it works but I leave out a line of code....

Namespace SampleBars

    <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
    Public Class HelloWorldBar
        Inherits BandObject

    End Class


End Namespace

But I still need the

<BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar Or BandObjectStyle.TaskbarToolBarHelpText = "Shows bar that says hello.")>  _

right?



So If i try and do this

Namespace SampleBars

    <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
    <BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar Or BandObjectStyle.TaskbarToolBarHelpText = "Shows bar that says hello.")>  _
    Public Class HelloWorldBar
        Inherits BandObject

    End Class


End Namespace

I get errors on the "<BandObject(..." Line that say: Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.

I get an error stating that the inherits statement isn't valid in a namespace

I get an error message stating that the end class must appear after a class statement.

So it would appear that my error is in he <BandObject( line....

Anyone have any ideas
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 315 total points
ID: 13430180
Yeah, wasn't paying attention.  C# doesn't need line continuation:

Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports BandObjectLib
Imports System.Runtime.InteropServices

Namespace SampleBars

 <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
 <BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar, _  
   BandObjectStyle.TaskbarToolBarHelpText="Shows bar that says hello.")> _
 Public Class HelloWorldBar : Inherits BandObject
 End Class

End Namespace

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13430203
We're gonna get there eventually.


Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports BandObjectLib
Imports System.Runtime.InteropServices

Namespace SampleBars

 <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
 <BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar Or _
       BandObjectStyle.TaskbarToolBar, HelpText="Shows bar that says hello.")> _
 Public Class HelloWorldBar : Inherits BandObject
 End Class

End Namespace

Bob
0
 

Author Comment

by:NickOlsen
ID: 13431576
Same problem......i tried what you have above and i get crazy errors....


Namespace SampleBars

 <Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")> _
 [1]<BandObject("Hello World Bar", BandObjectStyle.Horizontal Or BandObjectStyle.ExplorerToolbar Or _
       BandObjectStyle.TaskbarToolBar, HelpText="Shows bar that says hello.")> _
 Public Class HelloWorldBar
       [2]Inherits BandObject  ' //there is no ':' in vb.net for inherits

[3] End Class

End Namespace


At [1] error = Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
At [2] error = Statment not valid in a namespace
At [3] error = End Class must follow a preceding Class statement
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13431628
Test:

(1) Create a new class.
(2) Put Imports BandObjectLib at the top
(3) Type <BandObject( before the class definition
(4) Tell me what arguments are listed in the auto-completion.

In VB, the ':' is a single line continuation, so that you can put multiple lines on the same line.  This allows you to get a line that looks similar to C#.

VB.NET:
Public Class HelloWorldBar : Inherits BandObject  

C#:
Public Class HelloWorldBar : BandObject

You can do it either way, just personal preference on my part.

Bob
0
 

Author Comment

by:NickOlsen
ID: 13431707
There are two options

New([HelpText As String], [Name As String], [Style As BandObjecLib.BandObjectStyle])

or

New([name as String], sytle as BandObjectLib.BandObjectStyle, [HelpText as String])

I am using the second one

Good to know about the ':'

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13431811
Nick,

You know what would help--what are you working with?  Is this a 3rd party control?  Home-cooked?

Bob
0
 

Author Comment

by:NickOlsen
ID: 13431957
This is actualy a program that I found in c# that allows you to make a windows task bar toolbar (ie when you minimize windows media player and it just sits in the task bar next to the clock, or googles new deskbar serach tool) if you right click on the task bar and select toolbars, there is a list of toolbars you can choose from...anyway its something like that.

I have written a program in vb .net that is basically the windows run function (start >> run) on over drive that allows users to do bunch of extra things.  At the moment, I just have my program docked at the bottom right hand corner of the screen but I wanted to get it so it sits in the actual tasbar instead.  I was able to get it all to work in c# but i actually coded my program in vb so I was hoping to convert just the functionality of putting it in the tasbar.  

I have the C# project and all required files avaiilable here...

http://www.cabbdistributors.com/downloads/dotnetBandObjects.zip

Go ahead and take a look

Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question