Code Conversion with a GUID

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
NickOlsenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
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
AlexFMCommented:
For example:

<GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")> _
Public Class SampleClass
   ...
End Class
0
Bob LearnedCommented:
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
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

NickOlsenAuthor Commented:
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
Bob LearnedCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
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
NickOlsenAuthor Commented:
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
Bob LearnedCommented:
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
NickOlsenAuthor Commented:
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
Bob LearnedCommented:
Nick,

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

Bob
0
NickOlsenAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.