Conversion Problem

  • Thread starter Thread starter John
  • Start date Start date
Lloyd Sheen said:
As far as I know this is a VB.NET group and curly brackets are part of the
syntax. Grow up.

Way to sidestep the fact you misread my post. Great job.net
 
Are you sure i + j * 2 + k * 2 * 3 gives the required index for the new
array only this doesn't seem to work

I can now get the records ok and get back all the other information but when
i use the i,j,k to get the value from xcoords(100, 10, 2) or
ycoords(100,10,2) I seem to get zero returned when it is not zero.

for example if i need to access xcoords(1,1,1) this translates to accessing
xcoords(9) in the new array is that correct? Or should there be some
brackets in the above evaluation.
 
Tom Shelton said:
Oh, please. VB6 sixes help sucks rocks. VB5 had the last decent help.
The
internet has been the primary source of real help for years.

....oh... and, if you still have VB6, drop a control on the form, select it
and hit F1. That will take you to the help for that control, showing all
events, properties and methods. Select any property in the property window,
hit F1. Help will open and show sample code to use that property. Open the
object browser and select any property/method/event... hit F1. If that
doesn't show help, your environment's trashed or it's a 3rd party object
that never had context sensitive help.
So, you admit that the SAME event procedure can NOT handle the same event
for
diffent individual controls (not control arrays) or differing types of
controls... Thanks.

So, you admit there's no benefit to using the same event handler for
multiple controls when the functionality has been there for what... 3
decades?... Thanks.
As for your work around, sure - used to do it all the time, still do as a
matter of fact. It just depends on the task at hand. C#/VB.NET just adds
an
extra tool to my belt.

We all know how a plumber looks when wearing too many tools on his belt.
You think:

Dim i As Integer = 10

Is unreadable? Wow.

Yes I do. When scanning thru hundreds of lines of code, there should be a
declarations section, an initialization section and a "working" section.
Anything else is... well... spaghetti code, at best.
Because that syntax sucks. The new syntax, is cleaner, highly readable
and
IMHO, more clearly convey's the intent of the author - thereby leading to
less bugs.

That's the key right there.... "by the author"... the author can read it...
right now, that is. In 5 years? A different developer? Maybe, maybe not.
Again, you don't like it - don't use it, but don't try to force your
strange
sesne of readability on others.

What ever Mr C programmer.
Again, a valid option. Hope it works for you, when the rest of the world
moves on to distributed systems and 64-bit apps....

Have fun... have you seen the poor excuses for a 64 bit OS? I've had 64 bit
CPUs since they were released... *still* no drivers for most hardware. 128
bit will be available before vendors ever get around to writing 64 bit
drivers.... this is because *they too* don't like anyone to tell them they
need to throw all of their previous work in the trash.
Goody for them.

Well... that says a lot. *you're* right and 5 million others are wrong.
That's kinda what I figured. Thanks for clearing that up.
Oh yea, Set. Another one of those idiotic VB.CLASSIC'isms, introduced as
a
bandaid to the whole default propety mess. You know, the feature that
most
proffesionals and MVP's discouraged people from using for years.

Yep... default properties are a source of confusion and shouldn't be
encouraged... look what MS did to "Label1.Caption ="... changed that to
"Label1.Text" while 3rd party vendors continued to use .Caption... who's
right? Why the change in the first place?
Because they screwed up their installer. What does that have to do with
.NET?

Well... isn't "XCopy Deployment" and that "Click Once" junk part of the .Net
sales pitch?
Just as most of us have figured out how to deal with framework
installations... But, it didn't stop you from bringing that up, so I
thought
I'd just point out one of the flaws in VB6 installations. Nothing is
perfect.

Now, that's something we can all agree on... nothing's perfect.
Yes, just as your statements were your opinion... It's just that mine are
more grounded in reality and the current market - but, I guess that's what
comes of not shackling myself to a product that's useful lifetime expired
some
time in the last decade.

That "expired" stuff may be true where you work.. but, not here.
What are you talking about?

There's a key called Ctrl on your keyboard. There's also a "C" and a "V"

A) Go to your code window
B) Select a block of text. fyi, a "Block" is generally 2 or more lines of
text, separated by CR/LF
C) Copy that block to the clipboard by holding down the key called "Ctrl"
and pressing "C"
D) Find the immediate window
E) Paste that block into the window by holding down the key called "Ctrl"
and pressing "V"

Is it still a block? Unchanged? Didn't think so...

Now, do the reverse

A) Go to your immediate window
B) Select a block of text. fyi, a "Block" is generally 2 or more lines of
text, separated by CR/LF
C) Copy that block to the clipboard by holding down the key called "Ctrl"
and pressing "C"
D) Find the code window
E) Paste that block into the window by holding down the key called "Ctrl"
and pressing "V"

Is it still a block? Unchanged? Didn't think so... in fact, it doesn't work
at all.
And no it doesn't have single procedure view. I'm sorry that you don't
like
that - but, you know what - I hate single procedure view. But, I'm sure
if
enough people requested it, it would have been added by now... Wait,
maybe
I'm not alone in hating single procedure view.

That's where you're wrong. Plenty of people asked for it... including
Microsoft Employees. How long would it have taken to implement? 30 minutes?
Do they care? No.
No they weren't.... You sure like to exagerate. The frameworks, are
supported under Vista - it's the IDE's that aren't supported. Big
difference.

I agree... big difference... especially when it's the IDE you're paying for,
when you shell out your money.
There was some talk of that in early beta's. Didn't happen. What
difference
does it make. Vista/2008 ship with the 3.0 framework.

Some talk <g> LOL... that was the entire sales pitch... some talk... funny.
 
Tom Shelton said:
Is that the best answer that you can come up with?

quality of answer = quality of question

Yes, on occasion - not as much anymore though. I do, however, do almost
100%
of my day to day coding in C#. So, yes I do like C-style syntax. I might
come back to VB if they ever make it case senstive :)

That's cool... but backs up a statement made long ago that, the most
prolific VB.Net supporters rarely use it themselves.
I'm not sure where you even get these numbers... Do you know how many
.net
developers there are? 1 million? 2 million? I don't know - it's never
really
concerned me. I'm making more money and having more fun then I ever did
with
VB.CLASSIC :)

There were, at one time, an estimated 5-6 million VB5/6 programmers... and,
now you're saying that, with all languages combined, there are /maybe/ 1 to
2 million dotNet devs.

I agree 1000% that dotNet is the "contractors dream come true" since they
can base their entire career on migrating apps, but that doesn't help
companies that have legacy code that can't be migrated... for any number of
reasons...

You don't need set in VB.NET - that mess has been cleaned up.

There's a difference in opinion there, too... no big deal. I like using
Set... actually didn't mind using Let/Get either... but Set makes it that
much easier to quickly browse, looking for code that passes object
references.
To bad... Is that why your so angry? Do you feel left out?

"left out" wouldn't be an issue if there were a VB language. We can't
migrate to dotNet here for *many* reasons.... and, lol, if you think I'm
angry, you ain't seen nuttin'
Let me rephrase, mr. snotty.... What is the point?

See right there... what's the point? "I don't use it... it's not
required".... what was that you said earlier about having tools in your
belt? Not sure about you, but I use the immediate window *all the time*...
for everything from writing replies to newsgroup questions (well, until May
1st, anyway), to testing code, to a simple copy/paste buffer.

....and "snotty"? You mean, like your reply to the OP where you started with
"LOL... The problem is John, that you are not familiar enough with the
framework and .NET"
Upgrade or continue to develop on XP - test on vista. Is the VB6 ide
supported on Vista? 2008 server?

All it takes is a visit to google to find that answer... but, I can save
that time for you... Yes. It's supported on both of those OSs... but,
really, that depends on what's meant by "supported"... as they say, it's
supported to the point of "It just works"... which makes sense, since MS
Office is written in C++ and relies heavily on COM, they aren't going to
break COM any time soon.
It was major pitch at the time, and I was a bit disappointed that it
didn't
materialize...

Looks like I was wrong with my "2%" remark anyway... I guess it's 4%
http://www.grimes.demon.co.uk/dotnet/vistaAndDotnet.htm

But, anyway... I've used my MS group allowance for the week, so y'all have a
great weekend.
 
Ken Halter said:
re-wrote VB basically from the ground up

Luckily they did. Finally got rid of all the hacks.



....talking about control arrays:

Why does a CommandButton have an Index (property) even if it does not belong
to a "control array"?


Or, create a control array of CommandButtons. Name it "Command1". Write
"MsgBox Command1.UBound". Put the caret on the word "Command1" and press
Ctrl+I. The IDE says: "Command1 As CommandButton". Huh?? The type of the
array is CommandButton, too? I thought that's the type name of a single
button. Where is that type declared? I don't find it in the object browser.
I not even find "Ubound" anywhere in the object browser. Maybe I should buy
new glasses.


Or, try this in the immediate window:

? typename(command1(index))
CommandButton
?typename(command1)
Object

"Object"? Well...and what is the type of the object? It's probably
"VB-special-type-under-the-hood-and-nobody-will-ever-know"?




Or, look at this, inside the Form:

Sub X(o As ???)
Msgbox o.
End Sub

Sub Y()
MsgBox Command1.UBound 'supported by intellisense
X Command1 'Remember: it's an array!
End Sub

By what do the ??? have to be replaced in order to get the intellisense list
(ubound, lbound, item, count) when typing "o." inside Sub X? What's the
type? Can you tell me?



BTW, I don't need control arrays too because the main intentions a
programmer has can be achieved by means that did not even exist in VB6. They
are:
- Create controls dynamically. "New CommandButton" does not work in VB6.
"New Button" works well in VB today.
- Attach/remove handlers dynamically. No more being forced to have a
template control at design time because Add/Removehandler did not even
exist. Now being able to attach any handler of any event as long as
signatures match. (and, you can name the handler whatever you want)


But I am fair. It's more work now if you have to attach the event of every
single control in the designer or in a loop to an event handler. However,
that's not a sufficient reason IMO as everything can still be done.

Keeping in mind that ".Net" was build from the ground up, there was no need
to reintroduce control arrays - but maybe they will come back like these
horrible Form default instances that still make beginners think a class is
an object.....

Hey, GoSub was so cool because we didn't have to pass arguments. Right.

My Amstrad CPC464 back in 198? "booted" within one second. Was it
better?



Armin
 
Ken Halter said:
It still cracks me up that Delphi and COBOL code can run nearly unchanged in
dotNet, yet VB code can't.... shouldn't really be a surprise though, since
Anders Hejlsberg had probably never seen VB and Paul "I'm the father of VB"
Vick has never touched pre-dotNet VB code at all. The blind leading the
blind. Simple as that.

I wonder if anyone here has tried VB Migration Partner...it sounds
interesting but there's no demo version now that the beta period has
passed (and their web page doesn't even tell you how many hundreds of
thousands of dollars it cost).
 
Armin Zingler said:
Luckily they did. Finally got rid of all the hacks.



...talking about control arrays:

Why does a CommandButton have an Index (property) even if it does not
belong
to a "control array"?

Hopefully, you're not expecting an object to add/remove properties, just
because it may or may not be part of an array.
Or, create a control array of CommandButtons. Name it "Command1". Write
"MsgBox Command1.UBound". Put the caret on the word "Command1" and press
Ctrl+I. The IDE says: "Command1 As CommandButton". Huh?? The type of the
array is CommandButton, too? I thought that's the type name of a single
button. Where is that type declared? I don't find it in the object
browser.
I not even find "Ubound" anywhere in the object browser. Maybe I should
buy
new glasses.

You may be right about "time for new glasses". In *my* object browser, it
clearly states:

Class CommandButton
Member of VB
Or, try this in the immediate window:

? typename(command1(index))
CommandButton
?typename(command1)
Object

"Object"? Well...and what is the type of the object? It's probably
"VB-special-type-under-the-hood-and-nobody-will-ever-know"?

"Object" didn't make that much sense... with that, I agree... but, since
*everything* is supposedly an "Object" in dotNet, why does it surprise you?
What *really* suprises me is the fact they simply renamed "Variant" to
"Object" for dotNet.
Or, look at this, inside the Form:

Sub X(o As ???)
Msgbox o.
End Sub

umm... you're saying you have an IDE that excepts question marks as a Type?
Better re-install.
Sub Y()
MsgBox Command1.UBound 'supported by intellisense
X Command1 'Remember: it's an array!
End Sub

By what do the ??? have to be replaced in order to get the intellisense
list
(ubound, lbound, item, count) when typing "o." inside Sub X? What's the
type? Can you tell me?

Exactly what information are you looking for here? Intellisense doesn't work
when there are errors or missing libraries. Is that a surprise?
BTW, I don't need control arrays too because the main intentions a
programmer has can be achieved by means that did not even exist in VB6.
They
are:
- Create controls dynamically. "New CommandButton" does not work in VB6.

Pulllleeeezzzzz. Gimme a freaking break. You can create all the controls you
need, array or not, at runtime. The fact *you* don't know how isn't a fault
of the language.
"New Button" works well in VB today.
- Attach/remove handlers dynamically. No more being forced to have a
template control at design time because Add/Removehandler did not even
exist. Now being able to attach any handler of any event as long as
signatures match. (and, you can name the handler whatever you want)

Not impressed.
But I am fair. It's more work now if you have to attach the event of every
single control in the designer or in a loop to an event handler. However,
that's not a sufficient reason IMO as everything can still be done.

Keeping in mind that ".Net" was build from the ground up, there was no
need
to reintroduce control arrays - but maybe they will come back like these
horrible Form default instances that still make beginners think a class is
an object.....

You're exactly right. dotNet was built from the ground up. In fact, the
original VB team at microsoft wrote the first version of the CLR for use
with VB7 (the *real* VB6 upgrade) and later walked out on MS when the dotNet
team literally stole their project from them.

Since it was built from the ground up, why did they literally steal the
name? It's not VB. You said so yourself. It's "something else", but it's not
VB. As I've said probably 1000 times now, if they'd have been honest enough
to come up with a new name, absolutely none of this VB vs B# crap would be
taking place.
Hey, GoSub was so cool because we didn't have to pass arguments. Right.

Is that supposed to mean something? I haven't used Gosub since the 1980's...
how about you? Pass arguments? umm... what ever.
My Amstrad CPC464 back in 198? "booted" within one second. Was it
better?

I can see you're settling in and just accepting slow boot times. Good for
you. imo, it shouldn't take a quad-core CPU with 4 gigs of ram to boot in
less time than it takes to mow your lawn... But, if that's what you like,
have at it.
 
Armin Zingler said:
Luckily they did. Finally got rid of all the hacks.

....btw...

hacks...in your code? Replaced by hacks.net? Doesn't take long to find posts
in this very forum that show, no matter what language you're using, you can
create junkware. You know... like that "VB Powerpack" non-sense? I thought
it was hilarious that, when they released the new version, they stated...
"An this actually works!" as if they knew their previous release was junk...
well... current release = junk, too.

Your reference to GoSub is quite telling... as were your comments about
control arrays.

Wonder why the "upgrade" group is a ghost town? Wonder why so many questions
here in this group never get answered... hmmmm.

But... no need to reply. I won't be around to read it (them?), so maybe you
guys can take some time, stop playing "fan boys" and help answer all, or at
least /some/, of the questions that go unanswered here. Not just the easy
ones.... btw, never said I didn't "know" B# (know more than the average
"newbie", but less than someone that's interested)... but I'll say I can't
stand the IDE and programming environment... and I *really* *HATE* the word
"evangelist" when it comes to their sales personnel... in a message from MS,
they asked "who's your local evangelist?"... I replied... "I don't know and
couldn't care less. This is a programming language, *not* a religion"
 
Ken Halter said:
Hopefully, you're not expecting an object to add/remove properties,
just because it may or may not be part of an array.

The object should not care whether or not it belongs to an array. Therefore
it must not have an Index property. If it does have an Index property it
always would have to belong to an array - which is not true either.
You may be right about "time for new glasses". In *my* object
browser, it clearly states:

Class CommandButton
Member of VB

This class does not have a UBound property. So again, where is the class
declared? If you find the property (and LBound, Count etc), send me a
screenshot.

"Object" didn't make that much sense... with that, I agree... but,
since *everything* is supposedly an "Object" in dotNet,

Try it in VB6, not in dotnet.
why does it surprise you?

It does not surprise me because I already know that not even VB6 is
able to tell me the class name of a control array.

What *really* suprises me is the fact they simply
renamed "Variant" to "Object" for dotNet.

That's because there is a CLS and a common type system now. I think the C#
people wouldn't understand why the VB people would have their
once-again-VB-special data type that is not even available in the Framework.
What's the purpose of 'Variant' if there is already 'Object'? I wouldn't
have an answer if I was asked this.

umm... you're saying you have an IDE that excepts question marks as
a Type? Better re-install.

Wrong. I wrote: "By what do the ??? have to be replaced..." (whole question
below again). Can you answer it?

Exactly what information are you looking for here?

I'm looking for the class name or type name of a control array that seems to
be defined nowhere. Because it's a hack.
Intellisense
doesn't work when there are errors or missing libraries. Is that a
surprise?

No. The problem is that there is no way to make it compilable because you
won't find the type anywhere.
Pulllleeeezzzzz. Gimme a freaking break. You can create all the
controls you need, array or not, at runtime. The fact *you* don't
know how isn't a fault of the language.

I do know how, but you obviously don't see that there is a difference made
between "normal" classes and controls. Because it's a hack.

Not impressed.

If you're not impressed by facts, a discussion rarely makes sense. Of
course, you can ingore them and do more work and be less flexible.

Since it was built from the ground up, why did they literally steal
the name? It's not VB. You said so yourself. It's "something else",
but it's not VB.

Is - is not - is - is not.... Only seeing black and white? What I always
say: The degree of similarity can not be measured. Some things have changed,
some things have not. How many percents? I don't know, and I don't care
which name is written on the package. You may be right, but what's in the
package is the only thing that counts. Making use of it's content, I can
still write "If..then", "function..end function", "sub...end sub", "do
loop", "select case". If I am not completeley mistaken that's taken from VB6
and not from C++, so, yeah, it's still Visual Basic. These are basic
language keywords. Even "End" still works....

I can see you're settling in and just accepting slow boot times.
Good for you. imo, it shouldn't take a quad-core CPU with 4 gigs of
ram to boot in less time than it takes to mow your lawn... But, if
that's what you like, have at it.

That's partially true. Actually I agree with you, so it's bringing sand to
the beach. It shouldn't take a quad-core etc, but I accept that it requires
more than a 64 KB machine to be able to do what I do nowadays.

Well,,, my main statement is: It saves me much more time by being able to
write "Inherits List(Of Whatever)" than it costs me by not having control
arrays any longer. And I feel better if I am able to use "New" with controls
just like with every other class because I don't see why I should be forced
to make a distinction like in VB6. An example only.


Armin
 
Ken Halter said:
...btw...

hacks...in your code? Replaced by hacks.net?

Which one?
Doesn't take long to
find posts in this very forum that show, no matter what language
you're using, you can create junkware.

I agree.
You know... like that "VB Powerpack" non-sense?

I don't know. Haven't used it.

Your reference to GoSub is quite telling... as were your comments
about control arrays.

I mentioned facts only. You were not able to answer my questions. Or you
just didn't want to admit that I was right.

Wonder why the "upgrade" group is a ghost town? Wonder why so many
questions here in this group never get answered... hmmmm.

Not answered? Even I answered thousands of them. *LOL*
But... no need to reply.

Sorry, too late.
This is a programming language, *not* a religion"

So why are you making a religious question out of it instead of just seeing
the facts?



Armin
 
If you don't miss control arrays, look at what I had to do

You can still put controls into an array once. Takes 2 minutes. Handle them
in a loop, for example when using Addhandler. Yes, little more work than in
VB6, but...

....how could I make it in VB6 to give each Alarm control an individual
meaningful name and handle an event of all of them in the same procedure? I
had to write 42 event handlers!


Armin
 
Oh it's such a bummer when big bad Microsoft makes things so difficult for
you isn't it!!!!

Instead of spitting your dummy, hit the F1 key and find one of the numerous
examples for dealing with arrays of various types of objects, or for that
matter Generic List's of various types of objects.

The following tok a whole 4 minutes:

Private m_alarm As New List(Of Alarm)
Private m_warn As New List(Of Warn)

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

For _i = 1 To 42
m_alarm.Add(CType(Controls.Find(String.Format("Alarm{0}", _i),
True)(0), Alarm))
AddHandler m_alarm(_i).ValueChanged, AddressOf AlarmChanged
' Add other event handler subscriptions here if necessary
m_warn.Add(CType(Controls.Find(String.Format("Warn{0}", _i), True)(0),
Warn))
' Add event handler subscriptions here if necessary
Next

End Sub

Private Sub AlarmChanged(ByVal sender As Object, ByVal e As EventArgs)

If Not bIgnoreClicks Then
Dim _i = m_alarm.IndexOf(CType(sender, Alarm))
CheckAlarmVsWarn(m_warn(_i), m_alarm(_i))
End If

End Sub

Certainly, the example assumes that your controls named Alarm1 through
Alarm42 are actually controls of type Alarm and have already been added to
your form. Similarly it assumes that your objects named Warn1 through
Warn42 are controls of type Warn and have also been added to your form. if
not then simply tweak the example accordingly.

You must realise that there is more than one way of skinning a cat.
 
Back
Top