?
Solved

Code Conversion with a GUID

Posted on 2005-02-28
12
Medium Priority
?
703 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
12 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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