Solution to using Left/Right in Forms without qualifiers

S

StrandElectric

????

Cor said:
Because you did it in the same likewise way as you was always doing in the
past to me.
For instance when I wrote that I did not find "Please turn to" really
friendly.

:)

He made already an excuse in another thread where he explained what
happened.

:)

Cor

"Armin Zingler" wrote in message
Am 19.01.2011 16:22, schrieb Cor:

??

I was writing to Mr.Strand. Why do you feel addressed?


Armin
 
A

Armin Zingler

Am 19.01.2011 18:08, schrieb StrandElectric:
Thanks for that! My, those MSDN references are comprehensive. That's what I
do call help!

It's a reference - the manual you are looking for. The job of the
reference part of a manual is not comprehensively explaining the
basics that you need for understanding the reference. That's done
in other parts of the manual. As I also said right from the start,
I do not consider that part been written didactically perfect.
Look in my old posts and you'll see. For this reason, I've tried
to do the impossible by writing two longer posts trying to teach
you the basics my way. You were thankful, but you asked me to
stop it. You are approaching the matter your own way and I accepted
it and tried accompanying you on your way. I'll keep on doing so.
So, I have only one plea: Don't complain about help!
The fact that you agree about help and print makes me feel that the string
issue is not such a major one. I had thought that you defended
*everything*.

Just like I also wrote right form the start that the help system got
worse with each version.
 
S

stukie

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

Intuitive? You still need to do a mental summersault to determine which
function to use depending on whether you want a string or a variant as a
result.

<sarcasm>And if it were easy to code programmers would not be making the
big bucks</sarcasm>
 
T

Tom Shelton

DanS formulated the question :
For instance for the former left there is nothing easier
than

dim x = theString.Substring(0,1) 'Which means one character
starting at the first position, however it can done in more
ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right

dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?
 
A

Armin Zingler

Am 19.01.2011 19:26, schrieb Tom Shelton:
BTW, I find String.Substring more intuitive than Right(String).
The lack of String.Right (or whatever it would be called), is a downside that I
find fault with like others do, too.
So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?

MSFT should've dropped the whole MSVB library. :) Because, instead
of being thankful to have the well-known names - even though we could do
well without - people complain about the BIG PROBLEMS they have walking
the LONG STONEY WAY in order to reach the GOAL FAR FAR AWAY.
No, in reality, it's just prepending a name as we do it a thousand
times a day in everday's business.

To the other guys:
I use "Msgbox" frequently even though there is Messagebox.Show!
It works without any prefix. Even in a Form. Why? Because it's not one
of the very few exceptions that this discussion going in circles is all
about.

Let me tell you something:

You can call
DateAdd
without a prefix.

You can call
DateDiff
without a prefix.

You can call
DatePart
without a prefix.

You can call
DateSerial
without a prefix.

You can call
DateValue
without a prefix.

You can call
Day
without a prefix.

You can call
Hour
without a prefix.

You can call
Minute
without a prefix.

You can call
Month
without a prefix.


Shall I continue? Oh yes, I will!

MonthName
Second
TimeSerial
TimeValue
Weekday
WeekdayName
Year
DateString
Now
TimeOfDay
Timer
TimeString
Today
ChDir
ChDrive
FileClose
FileCopy
FileGet
FileOpen
FilePut
FileWidth
Input
Kill
Lock
MkDir
Print

Shall I continue again? Or do you start seeing your
own narrow-minded view? You are really complaining
about ONE or TWO exceptions among dozends or hundreds of
functions and properties names, and these TWO names
only collide in conjunction with ONE special situation?



You only want to defend the opposite just because it is
the opposite. It's a piece of impudence that you steel our
time this way because it's time from people that are actually
meaning well. I have a lot of patience but this kind of your
irreverence is really contemptible!
 
T

Tom Shelton

Am 19.01.2011 19:26, schrieb Tom Shelton:

BTW, I find String.Substring more intuitive than Right(String).
The lack of String.Right (or whatever it would be called), is a downside that
I find fault with like others do, too.


MSFT should've dropped the whole MSVB library. :)

Oh, I don't know... There are a lot of useful functions there. I have
even been known on a rare occasion to add a refrence to
Microsoft.VisualBasic from my C# programs just so I could use some of
financial functions :) But, only rarely...
Because, instead
of being thankful to have the well-known names - even though we could do
well without - people complain about the BIG PROBLEMS they have walking
the LONG STONEY WAY in order to reach the GOAL FAR FAR AWAY.
No, in reality, it's just prepending a name as we do it a thousand
times a day in everday's business.

Agreed.

To the other guys:
I use "Msgbox" frequently even though there is Messagebox.Show!

LOL... I don't know why, but I tend to do the opposite :) Probably
because it works in C# as well.
It works without any prefix. Even in a Form. Why? Because it's not one
of the very few exceptions that this discussion going in circles is all
about.

Let me tell you something:

You can call
DateAdd
without a prefix.

You can call
DateDiff
without a prefix.

You can call
DatePart
without a prefix.

You can call
DateSerial
without a prefix.

You can call
DateValue
without a prefix.

You can call
Day
without a prefix.

You can call
Hour
without a prefix.

You can call
Minute
without a prefix.

You can call
Month
without a prefix.


Shall I continue? Oh yes, I will!

MonthName
Second
TimeSerial
TimeValue
Weekday
WeekdayName
Year
DateString
Now
TimeOfDay
Timer
TimeString
Today
ChDir
ChDrive
FileClose
FileCopy
FileGet
FileOpen
FilePut
FileWidth
Input
Kill
Lock
MkDir
Print

Shall I continue again? Or do you start seeing your
own narrow-minded view? You are really complaining
about ONE or TWO exceptions among dozends or hundreds of
functions and properties names, and these TWO names
only collide in conjunction with ONE special situation?

Agreed again!
You only want to defend the opposite just because it is
the opposite. It's a piece of impudence that you steel our
time this way because it's time from people that are actually
meaning well. I have a lot of patience but this kind of your
irreverence is really contemptible!

Again agreed. It's been explained in more then one way, why this
happends, what to do about it....
 
S

StrandElectric

Oh that! Well at 23 hrs (admittedly ADSL1) you must admit that it is quite
ludicrous! Imagine that on dial up (and there are some places in the Wolrd
that only have that).
 
S

StrandElectric

Tom Shelton said:
DanS formulated the question :
For instance for the former left there is nothing easier
than dim x = theString.Substring(0,1) 'Which means one character
starting at the first position, however it can done in more
ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?
Do you program commercially for successful organisations, Tom?
 
S

StrandElectric

...>>It's a piece of impudence that you steel our
Impressive list of easier procedures. Oh, is that me who is impudent and
'steals' your time? Ouch! And here was I thinking that the ng was for
exchanging views... Sigh... And I thought I meant well too. I'll just go
and cry behind the printer...
 
T

Tom Shelton

StrandElectric used his keyboard to write :
Tom Shelton said:
DanS formulated the question :
For instance for the former left there is nothing easier
than dim x = theString.Substring(0,1) 'Which means one character
starting at the first position, however it can done in more
ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?

-- Tom Shelton
Do you program commercially for successful organisations, Tom?

Yep. My employer is in the top 50 of the fortune 500.
 
S

StrandElectric

Tom Shelton said:
StrandElectric used his keyboard to write :
Tom Shelton said:
DanS formulated the question :
For instance for the former left there is nothing easier
than dim x = theString.Substring(0,1) 'Which means one character
starting at the first position, however it can done in more
ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?

-- Tom Shelton
Do you program commercially for successful organisations, Tom?

Yep. My employer is in the top 50 of the fortune 500.

Fair 'nuff Tom. I'll take you more seriously now. Running my own businesses
means that if I had marketed a product like vb.net I'd have gone bust; I
suppose if your vb.net apps don't work you'd lose your job, assuming that
you are using vb.net exclusively at work and that your employer does not
produce fripperies like games (whoops! That'll upset more people.) Perhaps
I should have said do you program serious financial or other business
applications that supply services to the business world? Not that that is
the be-all and end-all but it is a good indicator of the robustness of a
language and the ability to turn out required apps in a reasonable time.
 
T

Tom Shelton

StrandElectric laid this down on his screen :
Tom Shelton said:
StrandElectric used his keyboard to write :
DanS formulated the question :
For instance for the former left there is nothing easier
than dim x = theString.Substring(0,1) 'Which means one character
starting at the first position, however it can done in more
ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code than
Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a form - and
honestly, should you even have this logic there?

-- Tom Shelton

Do you program commercially for successful organisations, Tom?

Yep. My employer is in the top 50 of the fortune 500.

-- Tom Shelton

Fair 'nuff Tom. I'll take you more seriously now. Running my own businesses
means that if I had marketed a product like vb.net I'd have gone bust; I
suppose if your vb.net apps don't work you'd lose your job, assuming that you
are using vb.net exclusively

Nope. As noted somewhere in this thread - I almost never do VB.NET. I
program almost exclusively in C#.. Where there is no such thing as
Right, Left, Mid :) - but, the same rules of name resolution apply.

But, yes I would loose my job if I didn't get things done and they
didn't work :)
at work and that your employer does not produce
fripperies like games (whoops! That'll upset more people.)

No games. Not at work, though that is becomming somewhat of a hobby
lately.
Perhaps I should
have said do you program serious financial or other business applications
that supply services to the business world?

While the apps, are not finanacial in nature, they do provide
substancial financial savings to my employer - on the order of several
million dollars a month.
Not that that is the be-all and
end-all but it is a good indicator of the robustness of a language and the
ability to turn out required apps in a reasonable time.

Well, there is not a hairs difference between VB.NET and C#, beyond the
fact that VB.NET has it's own function library in addition to what the
..NET framework provides. C# has not intrinsic functions, it relies on
the framework.
 
T

Tom Shelton

DanS explained :
The version of VBx2008 I have has Strings.Right

That's.. Microsoft.VisualBasic.Strings.Right. Strings is the module
that Right is part of.
 
T

Tom Shelton

DanS formulated the question :
OK. I see that using the Object Browser.

But I don't need to qualify it in the form code, so I didn't
make a connection like that.

I just type strings. and intellisense shows me all the members
shown under Microsoft.VisualBasic.Strings. in the Object
Browser. It's not aliased or anything. That's just how it
worked, stock.

That's because VB.NET's namespace implementation sucks when it comes to
modules. It basically imports everything in a module to the entire
namespace... So, you don't ever have to use Strings.

It's another reason when I do work with VB.NET I don't use modules -
ever. I will do something like:

Class Strings
Private Sub New ()
End Sub

Public Shared Function Right (....) As String
...
End Function
End Class

That way, you always have to use the Strings qualifier and it doesn't
pollute the namespace.

Of course, it does make sense the reason they used a module for the
intrisic functions... Otherwise, you would always have to type:

dim y = Strings.Right(...)

And that really would violate the spirt of what they were trying to
accomplish :)
 
T

Tom Shelton

DanS brought next idea :
DanS formulated the question :
For instance for the former left there is nothing easier
than

dim x = theString.Substring(0,1) 'Which means one
character starting at the first position, however it can
done in more ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right

dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code
than Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a
form - and honestly, should you even have this logic there?

I don't see why not....if I've got a form with a text box, and
clicking some button on the form runs some code that uses a
substring of that text in the textbox, where else would you
put that code ?

In a class that implements the buisness logic.
 
T

Tom Shelton

DanS was thinking very hard :
DanS brought next idea :
DanS formulated the question :
For instance for the former left there is nothing
easier than

dim x = theString.Substring(0,1) 'Which means one
character starting at the first position, however it
can done in more ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for
the former right

dim y = theString.Substring(TheString.Length-10, 10)
'the last 10 positions.

Yeah, that's far more intuitive and a lot easier to code
than Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a
form - and honestly, should you even have this logic
there?

I don't see why not....if I've got a form with a text box,
and clicking some button on the form runs some code that
uses a substring of that text in the textbox, where else
would you put that code ?

In a class that implements the buisness logic.

The form is a class, therefore, it is already in the class it
needs to be in.

A form is a class that is true. But, it's responsibility is displaying
information - not processing. Separation of concerns my friend....

See the Model-View-Controler design pattern for a starting point of
what I'm talking about.
 
S

StrandElectric

DanS said:
DanS formulated the question :
For instance for the former left there is nothing easier
than

dim x = theString.Substring(0,1) 'Which means one
character starting at the first position, however it can
done in more ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right

dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code
than Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a
form - and honestly, should you even have this logic there?

I don't see why not....if I've got a form with a text box, and
clicking some button on the form runs some code that uses a
substring of that text in the textbox, where else would you
put that code ?
Right Dan. There are many business applications where a substring is a
meanigful part of the solution. Strikes me there is a kind of snobbery at
work here. A simple and logical solution cannot be the right one. It must be
elaborate in concept and if possible execution.
 
T

Tom Shelton

StrandElectric wrote :
DanS said:
DanS formulated the question :
For instance for the former left there is nothing easier
than

dim x = theString.Substring(0,1) 'Which means one
character starting at the first position, however it can
done in more ways.

But as soon as you know this and like Armin wrote are a
little bit familiar with Net programming, you do for the
former right

dim y = theString.Substring(TheString.Length-10, 10) 'the
last 10 positions.

Yeah, that's far more intuitive and a lot easier to code
than Right$(str,4).

[/sarcasm]

So, add the namespace alias and just do:

Dim y = VB.Right(str,4)

For crying out loud, you only have to do this inside of a
form - and honestly, should you even have this logic there?

I don't see why not....if I've got a form with a text box, and
clicking some button on the form runs some code that uses a
substring of that text in the textbox, where else would you
put that code ?
Right Dan. There are many business applications where a substring is a
meanigful part of the solution. Strikes me there is a kind of snobbery at
work here. A simple and logical solution cannot be the right one. It must be
elaborate in concept and if possible execution.

No, it's not snobbery - it's proper design. Yes, it's a little more
work up front, but it saves much time down the road in maintainablity
and extendability.
 

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