The free format?

K

kurt sune

VB is supposed to have free format.

I have tried, most for fun, to write a property on ONE line.

I have not succeded.

Can you?

<Bindable(False), _

Description("Sets the CSS class of the button."), _

Category("CssClasses"), _

DefaultValue("")> _

Public Property CssClassButton() As String

Get

Return _CssClassButton

End Get

Set(ByVal Value As String)

_CssClassButton = Value

End Set

End Property
 
A

Armin Zingler

kurt sune said:
VB is supposed to have free format.

What is "free format"?
I have tried, most for fun, to write a property on ONE line.

This is not possible.
I have not succeded.

Can you?

<Bindable(False), _

Description("Sets the CSS class of the button."), _

Category("CssClasses"), _

DefaultValue("")> _

Public Property CssClassButton() As String

Get

Return _CssClassButton

End Get

Set(ByVal Value As String)

_CssClassButton = Value

End Set

End Property


See also:
http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec12.asp


Armin
 
L

Larry Lard

kurt said:
VB is supposed to have free format.

No it isn't, at least VB.NET isn't. There are plenty of places where a
newline is syntactically necessary. In general, the Basic family of
languages has always been line-oriented. The C family of languages has
generally been character-oriented, and I believe C# retains this: you
can write perfectly acceptable C# programs on one line, if you want.

You would hate Python.
 
P

Patrice

What about telling us the error you see ? You may have a problem in the
surrounding code. Works here...
 
K

Ken Tucker [MVP]

Hi,

That should work. You will need imports system.componentmodel at the
top of the file for the attributes to work.

Ken
 
K

kurt sune

This code:
Public Overrides Property CssClass() As String : Get

End Get

Set(ByVal Value As String)

End Set

End Property



returns this error: "Method declaration statements must be the first
statement on a logical line"



/k
 
P

Patrice

IMO, expected for this one : is the separator for *executable* statements.
I'm not really suprised it doesn't work in a declaration statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top