VB 10 thoughts (part 4)
still teasing out thoughts from the cobwebs
- Date literals
today in VB you can only specify date literals in the format of #MM/dd/yyyy#
That’s incredibly USA centric. I’d like to input date literals in the form of dd/MM/yyyy, but because that would cause an ambiguity, I’d really like to see dd MMM yyyy, or failing that the ISO 8601 standard format of yyyy-MM-dd and yyyy-MM-ddThh:mm:ss
- select case object
I’ve been asking for this one for so long I forgot about it till I read the comments on Paul’s blog.
Ideally in the format of :Select Case sender Is
Case TextBox1
….
Case TextBox2
….similarly
- Catches in Using blocks
Again this is one that I had forgotten about.Using aDisopable As …..
Catch Ex As Exception
End Using
- Calling partial methods
VB 9 gives us partial methods, but the partial method itself has to be empty. It would be nice if there was a default method generated which you could still use, similar to the capabilities or Overrides but without the inheritance need. I thought the use OverWrite could be used, e.g:
Select Case TypeOf(sender) Is
Case TextBox
….
Case Label
….
'generated code Overwriteable Sub Foo() Dosomething() End Sub
'user code Overwrite Sub Foo() DosomethingElse()
Overwriten()'calls the generated overwriteable method End Sub
16 and 17 have my vote, 16 would be extremely useful.
tK
#15 There is only one logical one, ISO 8601 which is what everyone use in my country 🙂 (Maybe an Option DateFormat ISO8601? )
How about a StreamReader.ResetToPrevousLine method in the StreamReader class. This would allow us to stop the read operation and insert new data prior to the line just read then we could reset the buffer and continue to read where we left off at.
Example:
n_Line = StreamReader.Readline
If n_Line = “Line to stop at” Then
temp_File = writer.WriteLine(“Appended Text”)
StreamReader.ResetToPreviousLine
End If
temp_File = StreamReader.ReadLine
‘ The output to the temp_File would be:
Appended Text
Line to stop at
Here’s what I would like to see.
There is one thing I can’t get over in VB and that is that AND & OR doesn’t short circuit.
I use ANDALSO/ORELSE _EVERY_ single time, Could I have an Option ShortCircuit ON?
There is 2 things I would like to get rid of in VB, the line continuing character _ is plain annoying. It will be so even more with LINQ. And can someone tell me why its considered a compilation error if I end the line with ,_ Why cant the IDE insert the space char?
I would also like to see the the Dim keyword being optional or removed, Let was ditched in VB7.