As most of you know, .Net framework 4.0/Visual Studio 2010 supports implicit line continuation in VB, which was not available in previous versions (at least not to my knowledge). I have a situation where I am working on an ASP.Net 3.5 application that is targeting a machine that does not currently have .Net 4.0 installed and from what I understand it won't be installed for some time yet on that machine. Obviously, my development machine does have .net 4.0 installed.
With the implicit line continuation feature in VS2010, I sometimes find myself forgetting to add the continuation, and VS2010 does not have an issue with that even when I am targeting a previous version. Additionally, I know that if I actually compile the code (business objects and such), issues with line continuation are not a problem, as the compiled dll works fine as a 3.5 .net file.
My concern is this. There are areas where I am doing VB.Net coding in the code behind(beside?) for the asp.net pages. These would only be compiled on the server when they are first used, but since the server doesn't have the .net 4.0 framework (or even if it did), does anyone know if this would this cause the compilation to fail if I missed a line continuation? If so, is there a way to enforce using line continuation characters in VS2010?
I realize that some best practices might not be getting followed here, but I'm not about to change all the development dynamics around here just yet. Also, I'm not in an environment where I could easily test this out on my own.
I suddenly started having a problem with .vb pages refusing to build in ASP.NET 2010. No errors were displayed but the Output window would display something like:
I have a long line of text to write to the console so I end up with the following code. Mind you, the IDE (VB 2010 Express) error list gives no error when the code is like this, it even build without error. However when the console runs the debugger gives me an exeption error.
Why must the line continuation character be the last one on the line? Is there a technical reason for this or is this a usual Microsoft "feature"?
In other basic dialects you can add a comment after it, but not in VB.net, so I'm curious as to why Microsoft decided to not allow comments on these lines.
i notice that when i start next line of code and i press enter, it recompacts itself and the continued line moves left a bit... then if i place focus on the second line and press enter again, it (the second line) moves to the left some more, and it keeps doing this every time i focus on second line and press enter. how can i make it so that my second (and third etc) lines are formatted in a pre-determined way so they are always a certain amount of tabs indented to the right from where my line 1 starts?
Is there a way to disable the new VB 2010 implicit line continuations feature in Visual Studio 2010. We are using an TFS 2008 built service which doesn't support the new feature (sources in VS 2010 without errors getting built errors in TFS 2008 built service / we cannot update to TFS 2010 built service).
While reading an article by Deborah Kurata "Getting ready for VB10" under the section "Better Support for Lambda" she mentions using multi-line Lamba for debugging. So I tried it out on a class and worked just as she described (see figure 1). Now I am wondering if this can be done in regards to ForEach with a Dictionary as shown in figure 2. I am asking as when attempting to mimic the ForEach in figure 1 I get a message indicating there is no signature suitable for doing the multi-line Lambda statement for a ForEach
Private Sub Example() Dim Taxpayers = New List(Of Taxpayer) From {New Taxpayer With {
This is another continuation of an issue with a List(of T) as a property of a class.Following the excellent advice of AtmaWeapon and others on this forum, I have my classes working fine except for something that is inexplicable to me.I initialize my "course" class at a public level in a module. This is so the data in the class will be available program wide and for the application's lifetime. "Public newCourse As New Course".I initialize a local instantiation of the class TimeTable as newTimeTable [code] This issue is: The List(of T) is populated with data, however, when the loop finishes, what I have is the last set of values repeated "X" number of times in the List instead of the data being different in each element of List( Of T). [code]
I need my VB.net to write a file containing the following line
objWriter.WriteLine ("TEXTA " (FILEA) " TEXTB") Unfortunatly the variable (FILEA) is causing problems i now get the error Comma, ')', or valid expression continuation expected.
Several times while debugging a VB.Net program I have found that continuation lines are missing from a subroutine designed to handle an event. The continuation character "_" is there but the following line is missing
[Code]...
The first few times I figured I had made some editing error, but this has happened 3 times now, always in the same way (different subroutines but same place). As far as I can tell, no other continuation lines have changed. Is this a bug or some feature I have missed?
I am working on RSS feed. In Rssfeed <description> (string) tag suggest using approximately 300 characters and then showing continuation with [...] after a word break.
<description>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially [...]</description>
[Code]...
How we can do with a string by showing continuation with [...] after a word break?
I've frequently coded something along the lines of the sample below(with stuff like Dispose ommited for clarity. ). My question is, are the volatiles needed as shown? Or does the ManualResetEvent.Set have an implicit memory barrier as I've read Thread.Start does? Or would an explicit MemoryBarrier call be better than the volatiles? Or is it completely wrong? Also, the fact that the "implicit memory barrier behavior" in some operations is not documented as far as I've seen is quite frutrating, is there a list of these operations somewhere?
class OneUseBackgroundOp { background args[code].....
If default 'sa' account has sys_admin permissions for the whole SQL instance and all its databases. On the database itself, if I don't have db_datareader permission enabled, I would assume it doesn't need it as it is implied but I was wondering in .net, is there way to check if db_datareader has explicitly been enabled and not just implied from the 'sa' being a sys_admin.
I've recently had a strange issue with one of my APIs reported. Essentially for some reason when used with VB code the VB compiler does not do implicit casts to Object when trying to invoke the ToString() method.The following is a minimal code example firstly in C# and secondly in VB:
Graph g = new Graph(); g.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); foreach (Triple t in g.Triples)[code].....
This appears to be due to the fact that the type of the property t.Subject that I am trying to write to the console has explicitly defined ToString() methods which take parameters.The VB compiler appears to expect one of these to be used and does not seem to implicitly cast to Object and use the standard Object.ToString() method whereas the C# compiler does.Is there any way around this e.g. a VB compiler option or is it best just to ensure that the type of the property (which is an interface in this example) explicitly defines an unparameterized ToString() method to ensure compatability with VB?
Graph is an implementation of an interface but that is actually irrelevant since it is the INode interface which is the type that t.Subject returns which is the issue.INode defines two overloads for ToString() both of which take parameters Yes it is a compile time error No I do not use hide-by-name, the API is all written in C# so I couldn't generate that kind of API if I wanted to
Note that I've since added an explicit unparameterized ToString() overload to the interface which has fixed the issue for VB users.
VB 2008 Express edition. I'm pretty new to VB2008, a little over halfway through my first classi am writing a console program to ask the user for the price of gas for 7 days, then to get the average of that price. here is my code so far:
In C# you can use the implicit keyword to define an implicit user-defined type conversion operator.In VB.NET you can define a CType conversion operator that will explicitly convert a user-defined type into another type.Is there a way to declare an implicit conversion operator in VB.NET?
I have 2 methods with the same name, with diferente signatures.
Public Sub Method1(ByVal Parameter1 as String, ByVal Parameter2 as Boolean) Public Sub Method1(ByVal Parameter1 as Integer, Optional ByVal Parameter2 as Boolean = False, Optional ByVal Parameter3 as Boolean = False)
If I call Method1("My String Parameter", False) it will not give and error, it will try to convert the parameter to integer and use the overload.
Is there a way to forbid the implicit conversion in this specific method or in this specific parameter. For instance, I changed the second method name, but its not an elegant solution.
The code compiles and seems to run correctly, but is underlined with the message "Implicit Conversion from 'Double' to 'Single'" Why would this be an implicit conversion if each of the variables is cast as a Single? Is this something I should worry about or change?
VB.Net just showing its true colors again? When I turn Option Strict On, I am still able to do implicit narrowing conversions in a for each loop.For example, this code actually compiles;
Private Sub foobar() Dim foo() As foo = {New foo} For Each bar As bar In foo[code].....
From my understanding of Option Strict, this should not work.See here "Restricts implicit data type conversions to only widening conversions".My code above is a narrowing conversion, and so should be illegal.It will fail at runtime with an InvalidCastException. C# does the same thing. Below is another implicit narrowing conversion.
In C# I can create an interface, and when I use the interface the compiler knows that certain interface requirements are fulfilled by the base class. This is probably clearer with an example:
[Code]...
On all my forms, or is a better route creating an abstract base class that has SetupForm() (and how do you do that in VB.net)?
I have a C# library that internal clients configure with VB.Net Their scripts are throwing an InvalidCastException where they really shouldn't.
So the code is something like this (massively simplified):
//C#3 public class Foo { public static implicit operator Foo ( Bar input )
[Code].....
Strange - it looks like the VB.net compiler can find the cast operator but it's lost at runtime. Surely the VB and C# IL will be pretty similar here?
The VB.net code is dynamically compiled - the compile happens the first time a user logs into the app. it's being compiled as VB.Net against .Net 3.5, and I'm not using any COM interop.
Possible Duplicate: How can I create an interface in VBNet with implicit implimentations I'm normally a C# developer and completely new to VB.NET, so be nice with me.;) Let's say that I have this base class:
[Code]....
Is there any way of not having to use these "proxy"-calls to the real method? I haven't found any useful information about this in the CLI-specification, which makes me suspect that this is a VB.NET "feature". Is this the case?