473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Conversion Problem

Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i cannot
declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record structures
with openfile and random access? Why does vbfixedarray only allow 2
dementions?????

Cheers
John

Jul 10 '08 #1
43 2303
It sounds like you are still adjusting to VB.NET. Have you looked at the
documentation for the Len method? What you want to use is the GetLength (or
the GetLongLength) method of the Array class. For example:

x.GetLength(0)
x.GetLength(1)
x.GetLength(2)

would return the values:

10
10
2

Hopefully this helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <no***************@nothing.comwrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #2
i am totally confused by this reply, in your example it looks like the total
length is 22? but an array of (10,10,2) would be 400 or more depending on
the type of data. then there is all the other elements of the structure as
well

how exactly does your reply work when evaluating the record length to put in
the FileOpen statement?

sorry if i seem a bit dim :-) but i really don't understand your reply at
all
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It sounds like you are still adjusting to VB.NET. Have you looked at the
documentation for the Len method? What you want to use is the GetLength
(or the GetLongLength) method of the Array class. For example:

x.GetLength(0)
x.GetLength(1)
x.GetLength(2)

would return the values:

10
10
2

Hopefully this helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <no***************@nothing.comwrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
>Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #3
An array is basically a pointer so the Len is not correct.

A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to read
your data and possibly to copy in the final array (it might be needed anyway
as I'm not sure if .NET arrays and VB arrays are storing data using the same
ordering).

Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType(Sho rt))*x.Length)

Another option could be to read each member, you can add a method to your
structure to do add (youll need just the overall size, is this a constant in
your case ?) and AFAIK datta are read based on the length of the receiving
object (depends also how is was done in VB I suppose).

Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose possible
read/write problems more easily...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe de
discussion : uh**************@TK2MSFTNGP05.phx.gbl...
Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #4
thanks Patrice for that - i considered doing a fudge but the values are out
so there seems to be an overhead in the array structure differences in the
vb6 and vb8 - the 2 values do not come out the same anyway- they are a few
hundred bytes different so the chances of reading and writing correctly into
the old records is zero, and i don't fancy spending the rest of my life just
trying to fudge something that works.

i tried Runtime.InteropServices.Marshal.SizeOf(GetType(Sho rt))*x.Length but
it just gives me an error saying length is not a member of x so i don't know
whether this would work or not!!

god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement that
is limited to 2 dimentions?) and why they call it vb god knows, i've used vb
since the 70's without any problem everything i try to do in this turns out
to be a nightmare - perhaps i'm just too old and fixed in my ways
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@microsof t.com...
An array is basically a pointer so the Len is not correct.

A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to read
your data and possibly to copy in the final array (it might be needed
anyway as I'm not sure if .NET arrays and VB arrays are storing data using
the same ordering).

Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType(Sho rt))*x.Length)

Another option could be to read each member, you can add a method to your
structure to do add (youll need just the overall size, is this a constant
in your case ?) and AFAIK datta are read based on the length of the
receiving object (depends also how is was done in VB I suppose).

Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose
possible read/write problems more easily...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #5
Ok i've got the Runtime.InteropServices.... bit to work

I've done it on all the elements of the structure and added them together
but i'm 4 bytes out?

I suppose i could just hard code the record length - but it seems a very
poor way of doing things.
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
thanks Patrice for that - i considered doing a fudge but the values are
out so there seems to be an overhead in the array structure differences in
the vb6 and vb8 - the 2 values do not come out the same anyway- they are a
few hundred bytes different so the chances of reading and writing
correctly into the old records is zero, and i don't fancy spending the
rest of my life just trying to fudge something that works.

i tried Runtime.InteropServices.Marshal.SizeOf(GetType(Sho rt))*x.Length
but it just gives me an error saying length is not a member of x so i
don't know whether this would work or not!!

god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement that
is limited to 2 dimentions?) and why they call it vb god knows, i've used
vb since the 70's without any problem everything i try to do in this turns
out to be a nightmare - perhaps i'm just too old and fixed in my ways
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@microsof t.com...
>An array is basically a pointer so the Len is not correct.

A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to read
your data and possibly to copy in the final array (it might be needed
anyway as I'm not sure if .NET arrays and VB arrays are storing data
using the same ordering).

Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType(Sh ort))*x.Length)

Another option could be to read each member, you can add a method to your
structure to do add (youll need just the overall size, is this a constant
in your case ?) and AFAIK datta are read based on the length of the
receiving object (depends also how is was done in VB I suppose).

Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose
possible read/write problems more easily...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use
the fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #6
OK forget it - there is a more serious problem with this, it seems that vb8
does not support arrays declared like arr1(10,10,10) because when you try to
do the Fileput it just gives an error saying only 2 dimentional arrays are
supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only other
option it seems is to scrap all my hundreds of records and then design the
structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Ok i've got the Runtime.InteropServices.... bit to work

I've done it on all the elements of the structure and added them together
but i'm 4 bytes out?

I suppose i could just hard code the record length - but it seems a very
poor way of doing things.
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
>thanks Patrice for that - i considered doing a fudge but the values are
out so there seems to be an overhead in the array structure differences
in the vb6 and vb8 - the 2 values do not come out the same anyway- they
are a few hundred bytes different so the chances of reading and writing
correctly into the old records is zero, and i don't fancy spending the
rest of my life just trying to fudge something that works.

i tried Runtime.InteropServices.Marshal.SizeOf(GetType(Sho rt))*x.Length
but it just gives me an error saying length is not a member of x so i
don't know whether this would work or not!!

god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement
that is limited to 2 dimentions?) and why they call it vb god knows, i've
used vb since the 70's without any problem everything i try to do in this
turns out to be a nightmare - perhaps i'm just too old and fixed in my
ways
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@microso ft.com...
>>An array is basically a pointer so the Len is not correct.

A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to read
your data and possibly to copy in the final array (it might be needed
anyway as I'm not sure if .NET arrays and VB arrays are storing data
using the same ordering).

Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType(S hort))*x.Length)

Another option could be to read each member, you can add a method to
your structure to do add (youll need just the overall size, is this a
constant in your case ?) and AFAIK datta are read based on the length of
the receiving object (depends also how is was done in VB I suppose).

Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose
possible read/write problems more easily...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional
arrays which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use
the fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????

Cheers
John

Jul 10 '08 #7
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
>
god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement that
is limited to 2 dimentions?) and why they call it vb god knows, i've used
vb since the 70's without any problem everything i try to do in this turns
out to be a nightmare - perhaps i'm just too old and fixed in my ways
It's not you... the dotNet "VB Team" hasn't a clue what VB is. They're all C
programmers and re-wrote VB basically from the ground up, when the actual VB
team bailed out. I'd almost bet the current VB team has never written an app
in VB6, other than quick hacks to try something out.
just to get the same thing as dim arr1(100,100,2)
.....and, don't forget... those dimensions are 0 based, so that's 101 * 101 *
3 elements... but that's all I have <gI use VB6 100% of the time at work
and home, so I actually get stuff done..

Just passin' thru
Jul 10 '08 #8
On 2008-07-10, John <no***************@nothing.comwrote:
Hi

This .net is driving me crazy!!

In VB6 I had a type which contained a couple of multi-dimentional arrays
which i used to create and read records:

Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type

I'm trying to get vb8 set up so that i can use the same files and use the
fileopen method to randomly access the file data etc

vb8 won't let me use <vbfixedarraywith more than 2 dementions so i cannot
declare it correctly in the structure declaration.

What i have done is:

Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
Dim x as z
I have then tried to Redim in an initialation so:
redim x.array1(10,10,2)
redim x.array2(20,20,4)

But when i go to get the record length Len(x) it is totally wrong

Is there any way out of this mess so i can use my original record structures
with openfile and random access? Why does vbfixedarray only allow 2
dementions?????

Cheers
John
You can alawys use COM interop and put your file access in a VB6 dll :) There
are a lot of differences between VB6's array implementation (SafeArray) and
..NET's implementation - and so, there are probably going to be some differences
that might be hard to account for when reading binary files created in VB6...

--
Tom Shelton
Jul 10 '08 #9
glad to know its not just me, i would not even have considered using vb8 but
i do like the new updated appearance and i was worried that eventually vb6
would not work with microsofts operating system updates.

practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly the
whole day trying to achieve something that cannot be done simply (the best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build them
at run time and spend hours trying to get the layout correct, - printing -
you cannot easily specify a new page without going into a recursive print
handler which takes more time trying to handle your printing, etc etc all
simple stuff but a nightmare in this product.

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comwrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
>>
god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement
that is limited to 2 dimentions?) and why they call it vb god knows, i've
used vb since the 70's without any problem everything i try to do in this
turns out to be a nightmare - perhaps i'm just too old and fixed in my
ways

It's not you... the dotNet "VB Team" hasn't a clue what VB is. They're all
C programmers and re-wrote VB basically from the ground up, when the
actual VB team bailed out. I'd almost bet the current VB team has never
written an app in VB6, other than quick hacks to try something out.
>just to get the same thing as dim arr1(100,100,2)

....and, don't forget... those dimensions are 0 based, so that's 101 * 101
* 3 elements... but that's all I have <gI use VB6 100% of the time at
work and home, so I actually get stuff done..

Just passin' thru
Jul 10 '08 #10
On 2008-07-10, John <no***************@nothing.comwrote:
glad to know its not just me, i would not even have considered using vb8 but
i do like the new updated appearance and i was worried that eventually vb6
would not work with microsofts operating system updates.

practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly the
whole day trying to achieve something that cannot be done simply (the best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build them
at run time and spend hours trying to get the layout correct, - printing -
you cannot easily specify a new page without going into a recursive print
handler which takes more time trying to handle your printing, etc etc all
simple stuff but a nightmare in this product.
LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH easier
then VB6. I know, I spent years doing VB work. I'm not claiming every thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

' you can do this in the ide - just select all of the controls you want, go
' to the event tab in the properties window and add the handler - the ide will
' automatically add the handles list :)
Private Sub Button_Click (ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click

Dim clickedButton As Button = DirectCast (sender, Button)
' do button stuff
End Sub

There are times that using index's to access a control are helpful... And
even that is a fairly simple task.

Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

...

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
' do cool stuff with the button
End Sub
End Class

Or you can index them from the containser controls collection at runtime by
the name:

Dim theButton As Button = DirectCast(Me.Controls("theButton"), Button)

There is no need to dynamically generate controls... You just have to
understand the differences and the capabilites of VB.NET and then you don't
have these types of issues (well, at least not as often).

As for your file issue, I only was half joking about your file access - the
fact is that .NET is a different target platform then VB6. VB6 targeted COM
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways is
not compatable. Personally, if I were you I would create a VB6 component that
would be able to convert the files into a more .NET friendly format and then
access them using the System.IO namespace classes. The FileXXX VB.NET native
functions are crap...

--
Tom Shelton
Jul 10 '08 #11
You are quite correct in saying i am not familiar enough with the framework
and .NET. My problem seems to be i'm trying to do the same things in vb.net
as i did in vb6 rather than taking the new approach to it. Frustrating never
the less.

It would certainly assist if the help provided more practical examples. I
suppose i should buy a book!

"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:3r******************************@comcast.com. ..
On 2008-07-10, John <no***************@nothing.comwrote:
>glad to know its not just me, i would not even have considered using vb8
but
i do like the new updated appearance and i was worried that eventually
vb6
would not work with microsofts operating system updates.

practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly
the
whole day trying to achieve something that cannot be done simply (the
best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build
them
at run time and spend hours trying to get the layout correct, -
printing -
you cannot easily specify a new page without going into a recursive print
handler which takes more time trying to handle your printing, etc etc all
simple stuff but a nightmare in this product.

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier
then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

' you can do this in the ide - just select all of the controls you want,
go
' to the event tab in the properties window and add the handler - the ide
will
' automatically add the handles list :)
Private Sub Button_Click (ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click

Dim clickedButton As Button = DirectCast (sender, Button)
' do button stuff
End Sub

There are times that using index's to access a control are helpful... And
even that is a fairly simple task.

Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

...

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
' do cool stuff with the button
End Sub
End Class

Or you can index them from the containser controls collection at runtime
by
the name:

Dim theButton As Button = DirectCast(Me.Controls("theButton"), Button)

There is no need to dynamically generate controls... You just have to
understand the differences and the capabilites of VB.NET and then you
don't
have these types of issues (well, at least not as often).

As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways
is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then
access them using the System.IO namespace classes. The FileXXX VB.NET
native
functions are crap...

--
Tom Shelton
Jul 11 '08 #12
What is the overall intent ? It's true that VB.NET is different. For example
the way to persists data is totally different so if you need to read legacy
data, it might be usefull to consider the other options that .NET could
bring to the table ("serialization" i..e the ability to persist data
structure to disk or using datasets that are a in memory db representation
(suitable only for small amouts of data) or a real db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de groupe de
discussion : uF*************@TK2MSFTNGP04.phx.gbl...
OK forget it - there is a more serious problem with this, it seems that
vb8 does not support arrays declared like arr1(10,10,10) because when you
try to do the Fileput it just gives an error saying only 2 dimentional
arrays are supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Ok i've got the Runtime.InteropServices.... bit to work

I've done it on all the elements of the structure and added them together
but i'm 4 bytes out?

I suppose i could just hard code the record length - but it seems a very
poor way of doing things.
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
>>thanks Patrice for that - i considered doing a fudge but the values are
out so there seems to be an overhead in the array structure differences
in the vb6 and vb8 - the 2 values do not come out the same anyway- they
are a few hundred bytes different so the chances of reading and writing
correctly into the old records is zero, and i don't fancy spending the
rest of my life just trying to fudge something that works.

i tried Runtime.InteropServices.Marshal.SizeOf(GetType(Sho rt))*x.Length
but it just gives me an error saying length is not a member of x so i
don't know whether this would work or not!!

god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement
that is limited to 2 dimentions?) and why they call it vb god knows,
i've used vb since the 70's without any problem everything i try to do
in this turns out to be a nightmare - perhaps i'm just too old and fixed
in my ways
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@micros oft.com...
An array is basically a pointer so the Len is not correct.

A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
read your data and possibly to copy in the final array (it might be
needed anyway as I'm not sure if .NET arrays and VB arrays are storing
data using the same ordering).

Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType( Short))*x.Length)

Another option could be to read each member, you can add a method to
your structure to do add (youll need just the overall size, is this a
constant in your case ?) and AFAIK datta are read based on the length
of the receiving object (depends also how is was done in VB I suppose).

Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose
possible read/write problems more easily...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
Hi
>
This .net is driving me crazy!!
>
In VB6 I had a type which contained a couple of multi-dimentional
arrays which i used to create and read records:
>
Type AAA
:
Array1(10,10,2) as Integer
Array2(20,20,4) as Integer
:
End Type
>
I'm trying to get vb8 set up so that i can use the same files and use
the fileopen method to randomly access the file data etc
>
vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
cannot declare it correctly in the structure declaration.
>
What i have done is:
>
Structure z
:
dim Array1(,,) as short
dim Array2(,,) as short
:
End Structure
>
>
Dim x as z
I have then tried to Redim in an initialation so:
>
>
redim x.array1(10,10,2)
redim x.array2(20,20,4)
>
But when i go to get the record length Len(x) it is totally wrong
>
Is there any way out of this mess so i can use my original record
structures with openfile and random access? Why does vbfixedarray only
allow 2 dementions?????
>
Cheers
John
Jul 11 '08 #13
Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net so I
can still use multiple records I created in the new application. I have
managed to handle all the other type conversions so vb net handles then
using the fileopen, fileget, fileput but the following record as stopped the
conversion in its tracks because of the multidementional array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to existing
data in the above record set that was created under vb6 - as you can see
there are literally thousands of cords that I certainly do not want to input
again, so basically I need to use the this same record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@microsof t.com...
What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need to
read legacy data, it might be usefull to consider the other options that
.NET could bring to the table ("serialization" i..e the ability to persist
data structure to disk or using datasets that are a in memory db
representation (suitable only for small amouts of data) or a real db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
>OK forget it - there is a more serious problem with this, it seems that
vb8 does not support arrays declared like arr1(10,10,10) because when you
try to do the Fileput it just gives an error saying only 2 dimentional
arrays are supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Ok i've got the Runtime.InteropServices.... bit to work

I've done it on all the elements of the structure and added them
together but i'm 4 bytes out?

I suppose i could just hard code the record length - but it seems a very
poor way of doing things.
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl.. .
thanks Patrice for that - i considered doing a fudge but the values are
out so there seems to be an overhead in the array structure differences
in the vb6 and vb8 - the 2 values do not come out the same anyway- they
are a few hundred bytes different so the chances of reading and writing
correctly into the old records is zero, and i don't fancy spending the
rest of my life just trying to fudge something that works.

i tried Runtime.InteropServices.Marshal.SizeOf(GetType(Sho rt))*x.Length
but it just gives me an error saying length is not a member of x so i
don't know whether this would work or not!!

god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement
that is limited to 2 dimentions?) and why they call it vb god knows,
i've used vb since the 70's without any problem everything i try to do
in this turns out to be a nightmare - perhaps i'm just too old and
fixed in my ways
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@micro soft.com...
An array is basically a pointer so the Len is not correct.
>
A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
read your data and possibly to copy in the final array (it might be
needed anyway as I'm not sure if .NET arrays and VB arrays are storing
data using the same ordering).
>
Another option would be to compute the record length
(Runtime.InteropServices.Marhsl.SizeOf(GetType (Short))*x.Length)
>
Another option could be to read each member, you can add a method to
your structure to do add (youll need just the overall size, is this a
constant in your case ?) and AFAIK datta are read based on the length
of the receiving object (depends also how is was done in VB I
suppose).
>
Your best bet would be likely to create a small test case using VB and
reading use VB.NET wiht easy checkable values to test and diagnose
possible read/write problems more easily...
>
--
Patrice
>
"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>Hi
>>
>This .net is driving me crazy!!
>>
>In VB6 I had a type which contained a couple of multi-dimentional
>arrays which i used to create and read records:
>>
>Type AAA
>:
>Array1(10,10,2) as Integer
>Array2(20,20,4) as Integer
>:
>End Type
>>
>I'm trying to get vb8 set up so that i can use the same files and use
>the fileopen method to randomly access the file data etc
>>
>vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
>cannot declare it correctly in the structure declaration.
>>
>What i have done is:
>>
>Structure z
>:
>dim Array1(,,) as short
>dim Array2(,,) as short
>:
>End Structure
>>
>>
>Dim x as z
>I have then tried to Redim in an initialation so:
>>
>>
>redim x.array1(10,10,2)
>redim x.array2(20,20,4)
>>
>But when i go to get the record length Len(x) it is totally wrong
>>
>Is there any way out of this mess so i can use my original record
>structures with openfile and random access? Why does vbfixedarray
>only allow 2 dementions?????
>>
>Cheers
>John
>
>

Jul 11 '08 #14
So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the 3D
array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks like a
3D array... (each cell is at a position so that each index uses the number
of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps to
switch to something better if another idea or a later update gives better
support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe de
discussion : #6**************@TK2MSFTNGP03.phx.gbl...
Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net so
I can still use multiple records I created in the new application. I have
managed to handle all the other type conversions so vb net handles then
using the fileopen, fileget, fileput but the following record as stopped
the conversion in its tracks because of the multidementional array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to existing
data in the above record set that was created under vb6 - as you can see
there are literally thousands of cords that I certainly do not want to
input again, so basically I need to use the this same record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@microsof t.com...
>What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need to
read legacy data, it might be usefull to consider the other options that
.NET could bring to the table ("serialization" i..e the ability to
persist data structure to disk or using datasets that are a in memory db
representation (suitable only for small amouts of data) or a real db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
>>OK forget it - there is a more serious problem with this, it seems that
vb8 does not support arrays declared like arr1(10,10,10) because when
you try to do the Fileput it just gives an error saying only 2
dimentional arrays are supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
Ok i've got the Runtime.InteropServices.... bit to work

I've done it on all the elements of the structure and added them
together but i'm 4 bytes out?

I suppose i could just hard code the record length - but it seems a
very poor way of doing things.
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl. ..
thanks Patrice for that - i considered doing a fudge but the values
are out so there seems to be an overhead in the array structure
differences in the vb6 and vb8 - the 2 values do not come out the same
anyway- they are a few hundred bytes different so the chances of
reading and writing correctly into the old records is zero, and i
don't fancy spending the rest of my life just trying to fudge
something that works.
>
i tried
Runtime.InteropServices.Marshal.SizeOf(GetType (Short))*x.Length but it
just gives me an error saying length is not a member of x so i don't
know whether this would work or not!!
>
god i really hate this vb.net stuff - why is everything such a pain? -
nothing seems logical (for example, why have a vbfixedarray statement
that is limited to 2 dimentions?) and why they call it vb god knows,
i've used vb since the 70's without any problem everything i try to do
in this turns out to be a nightmare - perhaps i'm just too old and
fixed in my ways
>
>
"Patrice" <http://www.chez.com/scribe/wrote in message
news:51**********************************@micr osoft.com...
>An array is basically a pointer so the Len is not correct.
>>
>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
>read your data and possibly to copy in the final array (it might be
>needed anyway as I'm not sure if .NET arrays and VB arrays are
>storing data using the same ordering).
>>
>Another option would be to compute the record length
>(Runtime.InteropServices.Marhsl.SizeOf(GetTyp e(Short))*x.Length)
>>
>Another option could be to read each member, you can add a method to
>your structure to do add (youll need just the overall size, is this a
>constant in your case ?) and AFAIK datta are read based on the length
>of the receiving object (depends also how is was done in VB I
>suppose).
>>
>Your best bet would be likely to create a small test case using VB
>and reading use VB.NET wiht easy checkable values to test and
>diagnose possible read/write problems more easily...
>>
>--
>Patrice
>>
>"John" <no***************@nothing.coma écrit dans le message de
>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>Hi
>>>
>>This .net is driving me crazy!!
>>>
>>In VB6 I had a type which contained a couple of multi-dimentional
>>arrays which i used to create and read records:
>>>
>>Type AAA
>>:
>>Array1(10,10,2) as Integer
>>Array2(20,20,4) as Integer
>>:
>>End Type
>>>
>>I'm trying to get vb8 set up so that i can use the same files and
>>use the fileopen method to randomly access the file data etc
>>>
>>vb8 won't let me use <vbfixedarraywith more than 2 dementions so i
>>cannot declare it correctly in the structure declaration.
>>>
>>What i have done is:
>>>
>>Structure z
>>:
>>dim Array1(,,) as short
>>dim Array2(,,) as short
>>:
>>End Structure
>>>
>>>
>>Dim x as z
>>I have then tried to Redim in an initialation so:
>>>
>>>
>>redim x.array1(10,10,2)
>>redim x.array2(20,20,4)
>>>
>>But when i go to get the record length Len(x) it is totally wrong
>>>
>>Is there any way out of this mess so i can use my original record
>>structures with openfile and random access? Why does vbfixedarray
>>only allow 2 dementions?????
>>>
>>Cheers
>>John
>>
>>
>

Jul 11 '08 #15
I've already tried to do something similar, but for some bizzar reason the
record lenghts in the vb are different to the so called equivalent in the
net and without knowing the reason why the chances of getting the correct
data back (even if it doesn't give an error) are pretty remote

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@microsof t.com...
So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the
3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks like
a 3D array... (each cell is at a position so that each index uses the
number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps to
switch to something better if another idea or a later update gives better
support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
>Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net
so I can still use multiple records I created in the new application. I
have managed to handle all the other type conversions so vb net handles
then using the fileopen, fileget, fileput but the following record as
stopped the conversion in its tracks because of the multidementional
array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to existing
data in the above record set that was created under vb6 - as you can see
there are literally thousands of cords that I certainly do not want to
input again, so basically I need to use the this same record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@microso ft.com...
>>What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need to
read legacy data, it might be usefull to consider the other options that
.NET could bring to the table ("serialization" i..e the ability to
persist data structure to disk or using datasets that are a in memory db
representation (suitable only for small amouts of data) or a real db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
OK forget it - there is a more serious problem with this, it seems that
vb8 does not support arrays declared like arr1(10,10,10) because when
you try to do the Fileput it just gives an error saying only 2
dimentional arrays are supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl. ..
Ok i've got the Runtime.InteropServices.... bit to work
>
I've done it on all the elements of the structure and added them
together but i'm 4 bytes out?
>
I suppose i could just hard code the record length - but it seems a
very poor way of doing things.
>
>
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl.. .
>thanks Patrice for that - i considered doing a fudge but the values
>are out so there seems to be an overhead in the array structure
>differences in the vb6 and vb8 - the 2 values do not come out the
>same anyway- they are a few hundred bytes different so the chances of
>reading and writing correctly into the old records is zero, and i
>don't fancy spending the rest of my life just trying to fudge
>something that works.
>>
>i tried
>Runtime.InteropServices.Marshal.SizeOf(GetTyp e(Short))*x.Length but
>it just gives me an error saying length is not a member of x so i
>don't know whether this would work or not!!
>>
>god i really hate this vb.net stuff - why is everything such a
>pain? - nothing seems logical (for example, why have a vbfixedarray
>statement that is limited to 2 dimentions?) and why they call it vb
>god knows, i've used vb since the 70's without any problem everything
>i try to do in this turns out to be a nightmare - perhaps i'm just
>too old and fixed in my ways
>>
>>
>"Patrice" <http://www.chez.com/scribe/wrote in message
>news:51**********************************@mic rosoft.com...
>>An array is basically a pointer so the Len is not correct.
>>>
>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
>>read your data and possibly to copy in the final array (it might be
>>needed anyway as I'm not sure if .NET arrays and VB arrays are
>>storing data using the same ordering).
>>>
>>Another option would be to compute the record length
>>(Runtime.InteropServices.Marhsl.SizeOf(GetTy pe(Short))*x.Length)
>>>
>>Another option could be to read each member, you can add a method to
>>your structure to do add (youll need just the overall size, is this
>>a constant in your case ?) and AFAIK datta are read based on the
>>length of the receiving object (depends also how is was done in VB I
>>suppose).
>>>
>>Your best bet would be likely to create a small test case using VB
>>and reading use VB.NET wiht easy checkable values to test and
>>diagnose possible read/write problems more easily...
>>>
>>--
>>Patrice
>>>
>>"John" <no***************@nothing.coma écrit dans le message de
>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>Hi
>>>>
>>>This .net is driving me crazy!!
>>>>
>>>In VB6 I had a type which contained a couple of multi-dimentional
>>>arrays which i used to create and read records:
>>>>
>>>Type AAA
>>>:
>>>Array1(10,10,2) as Integer
>>>Array2(20,20,4) as Integer
>>>:
>>>End Type
>>>>
>>>I'm trying to get vb8 set up so that i can use the same files and
>>>use the fileopen method to randomly access the file data etc
>>>>
>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions so
>>>i cannot declare it correctly in the structure declaration.
>>>>
>>>What i have done is:
>>>>
>>>Structure z
>>>:
>>>dim Array1(,,) as short
>>>dim Array2(,,) as short
>>>:
>>>End Structure
>>>>
>>>>
>>>Dim x as z
>>>I have then tried to Redim in an initialation so:
>>>>
>>>>
>>>redim x.array1(10,10,2)
>>>redim x.array2(20,20,4)
>>>>
>>>But when i go to get the record length Len(x) it is totally wrong
>>>>
>>>Is there any way out of this mess so i can use my original record
>>>structures with openfile and random access? Why does vbfixedarray
>>>only allow 2 dementions?????
>>>>
>>>Cheers
>>>John
>>>
>>>
>>
>

Jul 11 '08 #16
Works here . Are they fixed array VB 6 side ? I've seen in the doc that a
prefix is written or not depending on the exact type of the variable. For
example if you write a single record using VB6 what is the exact size of
your file in bytes ? (mine is 48 that is 2 elements*3 elements *4 elements*2
bytes).

Byte alignement could also come in to play and it's also possible to control
this
(http://msdn.microsoft.com/en-us/libr...e(VS.80).aspx).

Also be aware of your "option base" (do I remember ?). Are VB6 array 1 based
or 0 based. They are always 0 based in VB.NET....

I'm quite confident it can be done, I'll try to give this a closer look
later with your structure layout...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe de
discussion : OR**************@TK2MSFTNGP03.phx.gbl...
I've already tried to do something similar, but for some bizzar reason the
record lenghts in the vb are different to the so called equivalent in the
net and without knowing the reason why the chances of getting the correct
data back (even if it doesn't give an error) are pretty remote

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@microsof t.com...
>So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the
3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks like
a 3D array... (each cell is at a position so that each index uses the
number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps to
switch to something better if another idea or a later update gives better
support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
>>Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net
so I can still use multiple records I created in the new application. I
have managed to handle all the other type conversions so vb net handles
then using the fileopen, fileget, fileput but the following record as
stopped the conversion in its tracks because of the multidementional
array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to
existing data in the above record set that was created under vb6 - as
you can see there are literally thousands of cords that I certainly do
not want to input again, so basically I need to use the this same record
set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@micros oft.com...
What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need to
read legacy data, it might be usefull to consider the other options
that .NET could bring to the table ("serialization" i..e the ability to
persist data structure to disk or using datasets that are a in memory
db representation (suitable only for small amouts of data) or a real
db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
OK forget it - there is a more serious problem with this, it seems
that vb8 does not support arrays declared like arr1(10,10,10) because
when you try to do the Fileput it just gives an error saying only 2
dimentional arrays are supported - what a load of tat!!!
>
i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like
>
dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
>
>
just to get the same thing as dim arr1(100,100,2)
>
"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
>Ok i've got the Runtime.InteropServices.... bit to work
>>
>I've done it on all the elements of the structure and added them
>together but i'm 4 bytes out?
>>
>I suppose i could just hard code the record length - but it seems a
>very poor way of doing things.
>>
>>
>"John" <no***************@nothing.comwrote in message
>news:e%****************@TK2MSFTNGP03.phx.gbl. ..
>>thanks Patrice for that - i considered doing a fudge but the values
>>are out so there seems to be an overhead in the array structure
>>differences in the vb6 and vb8 - the 2 values do not come out the
>>same anyway- they are a few hundred bytes different so the chances
>>of reading and writing correctly into the old records is zero, and i
>>don't fancy spending the rest of my life just trying to fudge
>>something that works.
>>>
>>i tried
>>Runtime.InteropServices.Marshal.SizeOf(GetTy pe(Short))*x.Length but
>>it just gives me an error saying length is not a member of x so i
>>don't know whether this would work or not!!
>>>
>>god i really hate this vb.net stuff - why is everything such a
>>pain? - nothing seems logical (for example, why have a vbfixedarray
>>statement that is limited to 2 dimentions?) and why they call it vb
>>god knows, i've used vb since the 70's without any problem
>>everything i try to do in this turns out to be a nightmare - perhaps
>>i'm just too old and fixed in my ways
>>>
>>>
>>"Patrice" <http://www.chez.com/scribe/wrote in message
>>news:51**********************************@mi crosoft.com...
>>>An array is basically a pointer so the Len is not correct.
>>>>
>>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
>>>read your data and possibly to copy in the final array (it might be
>>>needed anyway as I'm not sure if .NET arrays and VB arrays are
>>>storing data using the same ordering).
>>>>
>>>Another option would be to compute the record length
>>>(Runtime.InteropServices.Marhsl.SizeOf(GetT ype(Short))*x.Length)
>>>>
>>>Another option could be to read each member, you can add a method
>>>to your structure to do add (youll need just the overall size, is
>>>this a constant in your case ?) and AFAIK datta are read based on
>>>the length of the receiving object (depends also how is was done in
>>>VB I suppose).
>>>>
>>>Your best bet would be likely to create a small test case using VB
>>>and reading use VB.NET wiht easy checkable values to test and
>>>diagnose possible read/write problems more easily...
>>>>
>>>--
>>>Patrice
>>>>
>>>"John" <no***************@nothing.coma écrit dans le message de
>>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>>Hi
>>>>>
>>>>This .net is driving me crazy!!
>>>>>
>>>>In VB6 I had a type which contained a couple of multi-dimentional
>>>>arrays which i used to create and read records:
>>>>>
>>>>Type AAA
>>>>:
>>>>Array1(10,10,2) as Integer
>>>>Array2(20,20,4) as Integer
>>>>:
>>>>End Type
>>>>>
>>>>I'm trying to get vb8 set up so that i can use the same files and
>>>>use the fileopen method to randomly access the file data etc
>>>>>
>>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions so
>>>>i cannot declare it correctly in the structure declaration.
>>>>>
>>>>What i have done is:
>>>>>
>>>>Structure z
>>>>:
>>>>dim Array1(,,) as short
>>>>dim Array2(,,) as short
>>>>:
>>>>End Structure
>>>>>
>>>>>
>>>>Dim x as z
>>>>I have then tried to Redim in an initialation so:
>>>>>
>>>>>
>>>>redim x.array1(10,10,2)
>>>>redim x.array2(20,20,4)
>>>>>
>>>>But when i go to get the record length Len(x) it is totally wrong
>>>>>
>>>>Is there any way out of this mess so i can use my original record
>>>>structures with openfile and random access? Why does vbfixedarray
>>>>only allow 2 dementions?????
>>>>>
>>>>Cheers
>>>>John
>>>>
>>>>
>>>
>>
>

Jul 11 '08 #17
No it was my mistake, the values are the same I forgot to subtract 1.

However when i do a FileGet(fileno, gamecoords, 1) on this record it fails.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:e0**************@TK2MSFTNGP06.phx.gbl...
Works here . Are they fixed array VB 6 side ? I've seen in the doc that a
prefix is written or not depending on the exact type of the variable. For
example if you write a single record using VB6 what is the exact size of
your file in bytes ? (mine is 48 that is 2 elements*3 elements *4
elements*2 bytes).

Byte alignement could also come in to play and it's also possible to
control this
(http://msdn.microsoft.com/en-us/libr...e(VS.80).aspx).

Also be aware of your "option base" (do I remember ?). Are VB6 array 1
based or 0 based. They are always 0 based in VB.NET....

I'm quite confident it can be done, I'll try to give this a closer look
later with your structure layout...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : OR**************@TK2MSFTNGP03.phx.gbl...
>I've already tried to do something similar, but for some bizzar reason
the record lenghts in the vb are different to the so called equivalent in
the net and without knowing the reason why the chances of getting the
correct data back (even if it doesn't give an error) are pretty remote

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@microso ft.com...
>>So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the
3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks
like a 3D array... (each cell is at a position so that each index uses
the number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps
to switch to something better if another idea or a later update gives
better support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net
so I can still use multiple records I created in the new application. I
have managed to handle all the other type conversions so vb net handles
then using the fileopen, fileget, fileput but the following record as
stopped the conversion in its tracks because of the multidementional
array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to
existing data in the above record set that was created under vb6 - as
you can see there are literally thousands of cords that I certainly do
not want to input again, so basically I need to use the this same
record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@micro soft.com...
What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need
to read legacy data, it might be usefull to consider the other options
that .NET could bring to the table ("serialization" i..e the ability
to persist data structure to disk or using datasets that are a in
memory db representation (suitable only for small amouts of data) or a
real db.
>
Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
>
>
--
Patrice
>
>
"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
>OK forget it - there is a more serious problem with this, it seems
>that vb8 does not support arrays declared like arr1(10,10,10) because
>when you try to do the Fileput it just gives an error saying only 2
>dimentional arrays are supported - what a load of tat!!!
>>
>i think i'll go back to vb6 that was a true RAD piece of kit, my only
>other option it seems is to scrap all my hundreds of records and then
>design the structure in vb8 so that it is something like
>>
>dim arr1(100,2)
>dim arr2(100,2)
>:
>:
>dim arr100(100,2)
>>
>>
>just to get the same thing as dim arr1(100,100,2)
>>
>"John" <no***************@nothing.comwrote in message
>news:%2****************@TK2MSFTNGP06.phx.gbl. ..
>>Ok i've got the Runtime.InteropServices.... bit to work
>>>
>>I've done it on all the elements of the structure and added them
>>together but i'm 4 bytes out?
>>>
>>I suppose i could just hard code the record length - but it seems a
>>very poor way of doing things.
>>>
>>>
>>"John" <no***************@nothing.comwrote in message
>>news:e%****************@TK2MSFTNGP03.phx.gbl ...
>>>thanks Patrice for that - i considered doing a fudge but the values
>>>are out so there seems to be an overhead in the array structure
>>>differences in the vb6 and vb8 - the 2 values do not come out the
>>>same anyway- they are a few hundred bytes different so the chances
>>>of reading and writing correctly into the old records is zero, and
>>>i don't fancy spending the rest of my life just trying to fudge
>>>something that works.
>>>>
>>>i tried
>>>Runtime.InteropServices.Marshal.SizeOf(GetT ype(Short))*x.Length but
>>>it just gives me an error saying length is not a member of x so i
>>>don't know whether this would work or not!!
>>>>
>>>god i really hate this vb.net stuff - why is everything such a
>>>pain? - nothing seems logical (for example, why have a vbfixedarray
>>>statement that is limited to 2 dimentions?) and why they call it vb
>>>god knows, i've used vb since the 70's without any problem
>>>everything i try to do in this turns out to be a nightmare -
>>>perhaps i'm just too old and fixed in my ways
>>>>
>>>>
>>>"Patrice" <http://www.chez.com/scribe/wrote in message
>>>news:51**********************************@m icrosoft.com...
>>>>An array is basically a pointer so the Len is not correct.
>>>>>
>>>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short
>>>>to read your data and possibly to copy in the final array (it
>>>>might be needed anyway as I'm not sure if .NET arrays and VB
>>>>arrays are storing data using the same ordering).
>>>>>
>>>>Another option would be to compute the record length
>>>>(Runtime.InteropServices.Marhsl.SizeOf(Get Type(Short))*x.Length)
>>>>>
>>>>Another option could be to read each member, you can add a method
>>>>to your structure to do add (youll need just the overall size, is
>>>>this a constant in your case ?) and AFAIK datta are read based on
>>>>the length of the receiving object (depends also how is was done
>>>>in VB I suppose).
>>>>>
>>>>Your best bet would be likely to create a small test case using VB
>>>>and reading use VB.NET wiht easy checkable values to test and
>>>>diagnose possible read/write problems more easily...
>>>>>
>>>>--
>>>>Patrice
>>>>>
>>>>"John" <no***************@nothing.coma écrit dans le message de
>>>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>>>Hi
>>>>>>
>>>>>This .net is driving me crazy!!
>>>>>>
>>>>>In VB6 I had a type which contained a couple of multi-dimentional
>>>>>arrays which i used to create and read records:
>>>>>>
>>>>>Type AAA
>>>>>:
>>>>>Array1(10,10,2) as Integer
>>>>>Array2(20,20,4) as Integer
>>>>>:
>>>>>End Type
>>>>>>
>>>>>I'm trying to get vb8 set up so that i can use the same files and
>>>>>use the fileopen method to randomly access the file data etc
>>>>>>
>>>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions
>>>>>so i cannot declare it correctly in the structure declaration.
>>>>>>
>>>>>What i have done is:
>>>>>>
>>>>>Structure z
>>>>>:
>>>>>dim Array1(,,) as short
>>>>>dim Array2(,,) as short
>>>>>:
>>>>>End Structure
>>>>>>
>>>>>>
>>>>>Dim x as z
>>>>>I have then tried to Redim in an initialation so:
>>>>>>
>>>>>>
>>>>>redim x.array1(10,10,2)
>>>>>redim x.array2(20,20,4)
>>>>>>
>>>>>But when i go to get the record length Len(x) it is totally wrong
>>>>>>
>>>>>Is there any way out of this mess so i can use my original record
>>>>>structures with openfile and random access? Why does vbfixedarray
>>>>>only allow 2 dementions?????
>>>>>>
>>>>>Cheers
>>>>>John
>>>>>
>>>>>
>>>>
>>>
>>
>

Jul 11 '08 #18
Try :

Structure SatLocation
Public origin As Short
Public _locationfixed As Short 'Boolean
Public _timefixed As Short 'Boolean
Public numberofsets As Short
<VBFixedArray(101 * 11 * 3 - 1)Public _xcoords() As Single
<VBFixedArray(101 * 11 * 3 - 1)Public _ycoords() As Single
Public stamp As Date

' Expose _ members as properties (see previous post for 3D arrays)
' TODO
End Structure

If I write a single record in VB6 and in VB9 it produces the same size on
disk. Members beginning with _ should be exposed using a property (seems the
cullprit were boolean values that are not using the same size)...

BTW I'm not sure what exactly are xcoords and ycoords but they could be
perhaps replaced by something that would be the same overall size but that
could be more handy such as an array of structure especially for the later
component. What are those 3 last values. Are they more handy addressed by an
index array rather than by a name (i.e. it could be MyCoords(100,2).x,
MyCoords(100,2).y, MyCoords(100,2).z and could be exposed also as
MyCoords(100,2).XYZ(0) if really needed the you would likely fit the 2 D
array limitation and wouldn't need any more the "exposed as a propery"
workaround....

Hope it helps.

--
Patrice

Jul 11 '08 #19
The actual text of the failure is: Offset and length were out of bounds for
the array or count is greater than the number of elements from index to the
end of the source collection.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:e0**************@TK2MSFTNGP06.phx.gbl...
Works here . Are they fixed array VB 6 side ? I've seen in the doc that a
prefix is written or not depending on the exact type of the variable. For
example if you write a single record using VB6 what is the exact size of
your file in bytes ? (mine is 48 that is 2 elements*3 elements *4
elements*2 bytes).

Byte alignement could also come in to play and it's also possible to
control this
(http://msdn.microsoft.com/en-us/libr...e(VS.80).aspx).

Also be aware of your "option base" (do I remember ?). Are VB6 array 1
based or 0 based. They are always 0 based in VB.NET....

I'm quite confident it can be done, I'll try to give this a closer look
later with your structure layout...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : OR**************@TK2MSFTNGP03.phx.gbl...
>I've already tried to do something similar, but for some bizzar reason
the record lenghts in the vb are different to the so called equivalent in
the net and without knowing the reason why the chances of getting the
correct data back (even if it doesn't give an error) are pretty remote

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@microso ft.com...
>>So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the
3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks
like a 3D array... (each cell is at a position so that each index uses
the number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps
to switch to something better if another idea or a later update gives
better support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net
so I can still use multiple records I created in the new application. I
have managed to handle all the other type conversions so vb net handles
then using the fileopen, fileget, fileput but the following record as
stopped the conversion in its tracks because of the multidementional
array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to
existing data in the above record set that was created under vb6 - as
you can see there are literally thousands of cords that I certainly do
not want to input again, so basically I need to use the this same
record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@micro soft.com...
What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need
to read legacy data, it might be usefull to consider the other options
that .NET could bring to the table ("serialization" i..e the ability
to persist data structure to disk or using datasets that are a in
memory db representation (suitable only for small amouts of data) or a
real db.
>
Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
>
>
--
Patrice
>
>
"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
>OK forget it - there is a more serious problem with this, it seems
>that vb8 does not support arrays declared like arr1(10,10,10) because
>when you try to do the Fileput it just gives an error saying only 2
>dimentional arrays are supported - what a load of tat!!!
>>
>i think i'll go back to vb6 that was a true RAD piece of kit, my only
>other option it seems is to scrap all my hundreds of records and then
>design the structure in vb8 so that it is something like
>>
>dim arr1(100,2)
>dim arr2(100,2)
>:
>:
>dim arr100(100,2)
>>
>>
>just to get the same thing as dim arr1(100,100,2)
>>
>"John" <no***************@nothing.comwrote in message
>news:%2****************@TK2MSFTNGP06.phx.gbl. ..
>>Ok i've got the Runtime.InteropServices.... bit to work
>>>
>>I've done it on all the elements of the structure and added them
>>together but i'm 4 bytes out?
>>>
>>I suppose i could just hard code the record length - but it seems a
>>very poor way of doing things.
>>>
>>>
>>"John" <no***************@nothing.comwrote in message
>>news:e%****************@TK2MSFTNGP03.phx.gbl ...
>>>thanks Patrice for that - i considered doing a fudge but the values
>>>are out so there seems to be an overhead in the array structure
>>>differences in the vb6 and vb8 - the 2 values do not come out the
>>>same anyway- they are a few hundred bytes different so the chances
>>>of reading and writing correctly into the old records is zero, and
>>>i don't fancy spending the rest of my life just trying to fudge
>>>something that works.
>>>>
>>>i tried
>>>Runtime.InteropServices.Marshal.SizeOf(GetT ype(Short))*x.Length but
>>>it just gives me an error saying length is not a member of x so i
>>>don't know whether this would work or not!!
>>>>
>>>god i really hate this vb.net stuff - why is everything such a
>>>pain? - nothing seems logical (for example, why have a vbfixedarray
>>>statement that is limited to 2 dimentions?) and why they call it vb
>>>god knows, i've used vb since the 70's without any problem
>>>everything i try to do in this turns out to be a nightmare -
>>>perhaps i'm just too old and fixed in my ways
>>>>
>>>>
>>>"Patrice" <http://www.chez.com/scribe/wrote in message
>>>news:51**********************************@m icrosoft.com...
>>>>An array is basically a pointer so the Len is not correct.
>>>>>
>>>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short
>>>>to read your data and possibly to copy in the final array (it
>>>>might be needed anyway as I'm not sure if .NET arrays and VB
>>>>arrays are storing data using the same ordering).
>>>>>
>>>>Another option would be to compute the record length
>>>>(Runtime.InteropServices.Marhsl.SizeOf(Get Type(Short))*x.Length)
>>>>>
>>>>Another option could be to read each member, you can add a method
>>>>to your structure to do add (youll need just the overall size, is
>>>>this a constant in your case ?) and AFAIK datta are read based on
>>>>the length of the receiving object (depends also how is was done
>>>>in VB I suppose).
>>>>>
>>>>Your best bet would be likely to create a small test case using VB
>>>>and reading use VB.NET wiht easy checkable values to test and
>>>>diagnose possible read/write problems more easily...
>>>>>
>>>>--
>>>>Patrice
>>>>>
>>>>"John" <no***************@nothing.coma écrit dans le message de
>>>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>>>Hi
>>>>>>
>>>>>This .net is driving me crazy!!
>>>>>>
>>>>>In VB6 I had a type which contained a couple of multi-dimentional
>>>>>arrays which i used to create and read records:
>>>>>>
>>>>>Type AAA
>>>>>:
>>>>>Array1(10,10,2) as Integer
>>>>>Array2(20,20,4) as Integer
>>>>>:
>>>>>End Type
>>>>>>
>>>>>I'm trying to get vb8 set up so that i can use the same files and
>>>>>use the fileopen method to randomly access the file data etc
>>>>>>
>>>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions
>>>>>so i cannot declare it correctly in the structure declaration.
>>>>>>
>>>>>What i have done is:
>>>>>>
>>>>>Structure z
>>>>>:
>>>>>dim Array1(,,) as short
>>>>>dim Array2(,,) as short
>>>>>:
>>>>>End Structure
>>>>>>
>>>>>>
>>>>>Dim x as z
>>>>>I have then tried to Redim in an initialation so:
>>>>>>
>>>>>>
>>>>>redim x.array1(10,10,2)
>>>>>redim x.array2(20,20,4)
>>>>>>
>>>>>But when i go to get the record length Len(x) it is totally wrong
>>>>>>
>>>>>Is there any way out of this mess so i can use my original record
>>>>>structures with openfile and random access? Why does vbfixedarray
>>>>>only allow 2 dementions?????
>>>>>>
>>>>>Cheers
>>>>>John
>>>>>
>>>>>
>>>>
>>>
>>
>

Jul 11 '08 #20
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:3r******************************@comcast.com. ..
On 2008-07-10, John <no***************@nothing.comwrote:

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier
....and he's not familiar with the framework because the help system sucks
like a hoover.
then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
256... and we can see "2 doesn't apply" from the over-bloated, "feature
rich" (aka bug fest) apps people create with dotNet.
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...
....and, you're saying that's not possible in VB5/6? If so, you may not be as
"great" as you assume.
>
Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}
Too bad that's not VB syntax. It's B#... I've been using basic and assembler
since 1981 and basic has *never* used curly braces. That's "C".... plus,
when the app is done, the code is readable in basic (and assembler)... not
that framework/linq/xml crap.... guess what... linq or any variant of SQL is
*NOT* part of any basic language that makes sense. That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment
..

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
Very readable.... NOT
>
As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM
....so, it worked. Which version(s) of the framework do your users need to
download? Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking "wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want what
you pay for, grab VS6

Even after... what... 7? 8 Years? No one knows what to call this "B#"... is
it VB.Net? is it VB#? How about B#? or maybe it's VB8? VB9? What ever. Have
fun.
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways
is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then
Yeah... or maybe just write the thing in VB6 and go on to the next job, eh?

But, like I said... you guys can have these freaking groups.
Jul 11 '08 #21
OK i've got it to read a record in now, i'll play around with it and see
where the data is actually being held and can be written and read

"John" <no***************@nothing.comwrote in message
news:uH****************@TK2MSFTNGP04.phx.gbl...
The actual text of the failure is: Offset and length were out of bounds
for the array or count is greater than the number of elements from index
to the end of the source collection.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:e0**************@TK2MSFTNGP06.phx.gbl...
>Works here . Are they fixed array VB 6 side ? I've seen in the doc that a
prefix is written or not depending on the exact type of the variable. For
example if you write a single record using VB6 what is the exact size of
your file in bytes ? (mine is 48 that is 2 elements*3 elements *4
elements*2 bytes).

Byte alignement could also come in to play and it's also possible to
control this
(http://msdn.microsoft.com/en-us/libr...e(VS.80).aspx).

Also be aware of your "option base" (do I remember ?). Are VB6 array 1
based or 0 based. They are always 0 based in VB.NET....

I'm quite confident it can be done, I'll try to give this a closer look
later with your structure layout...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : OR**************@TK2MSFTNGP03.phx.gbl...
>>I've already tried to do something similar, but for some bizzar reason
the record lenghts in the vb are different to the so called equivalent
in the net and without knowing the reason why the chances of getting the
correct data back (even if it doesn't give an error) are pretty remote

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@micros oft.com...
So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as
the 3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks
like a 3D array... (each cell is at a position so that each index uses
the number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps
to switch to something better if another idea or a later update gives
better support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de
groupe de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
Hi Patrice
>
My overall intent is to convert an existing VB6 application into
vb.net so I can still use multiple records I created in the new
application. I have managed to handle all the other type conversions
so vb net handles then using the fileopen, fileget, fileput but the
following record as stopped the conversion in its tracks because of
the multidementional array aspect.
>
The vb6 type structure is as follows:
>
Type satlocation
>
origin As Integer
>
locationfixed As Boolean
>
timefixed As Boolean
>
numberofsets As Integer
>
xcoords(100, 10, 2) As Single
>
ycoords(100, 10, 2) As Single
>
stamp As Date
>
End Type
>
What I need to do is to be able to read and write to randomly to
existing data in the above record set that was created under vb6 - as
you can see there are literally thousands of cords that I certainly do
not want to input again, so basically I need to use the this same
record set.
>
>
>
"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@micr osoft.com...
>What is the overall intent ? It's true that VB.NET is different. For
>example the way to persists data is totally different so if you need
>to read legacy data, it might be usefull to consider the other
>options that .NET could bring to the table ("serialization" i..e the
>ability to persist data structure to disk or using datasets that are
>a in memory db representation (suitable only for small amouts of
>data) or a real db.
>>
>Let me know if you are still heading to VB.NET I'll try to give this
>a closer look with a working sample...
>>
>>
>--
>Patrice
>>
>>
>"John" <no***************@nothing.coma écrit dans le message de
>groupe de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
>>OK forget it - there is a more serious problem with this, it seems
>>that vb8 does not support arrays declared like arr1(10,10,10)
>>because when you try to do the Fileput it just gives an error saying
>>only 2 dimentional arrays are supported - what a load of tat!!!
>>>
>>i think i'll go back to vb6 that was a true RAD piece of kit, my
>>only other option it seems is to scrap all my hundreds of records
>>and then design the structure in vb8 so that it is something like
>>>
>>dim arr1(100,2)
>>dim arr2(100,2)
>>:
>>:
>>dim arr100(100,2)
>>>
>>>
>>just to get the same thing as dim arr1(100,100,2)
>>>
>>"John" <no***************@nothing.comwrote in message
>>news:%2****************@TK2MSFTNGP06.phx.gbl ...
>>>Ok i've got the Runtime.InteropServices.... bit to work
>>>>
>>>I've done it on all the elements of the structure and added them
>>>together but i'm 4 bytes out?
>>>>
>>>I suppose i could just hard code the record length - but it seems a
>>>very poor way of doing things.
>>>>
>>>>
>>>"John" <no***************@nothing.comwrote in message
>>>news:e%****************@TK2MSFTNGP03.phx.gb l...
>>>>thanks Patrice for that - i considered doing a fudge but the
>>>>values are out so there seems to be an overhead in the array
>>>>structure differences in the vb6 and vb8 - the 2 values do not
>>>>come out the same anyway- they are a few hundred bytes different
>>>>so the chances of reading and writing correctly into the old
>>>>records is zero, and i don't fancy spending the rest of my life
>>>>just trying to fudge something that works.
>>>>>
>>>>i tried
>>>>Runtime.InteropServices.Marshal.SizeOf(Get Type(Short))*x.Length
>>>>but it just gives me an error saying length is not a member of x
>>>>so i don't know whether this would work or not!!
>>>>>
>>>>god i really hate this vb.net stuff - why is everything such a
>>>>pain? - nothing seems logical (for example, why have a
>>>>vbfixedarray statement that is limited to 2 dimentions?) and why
>>>>they call it vb god knows, i've used vb since the 70's without any
>>>>problem everything i try to do in this turns out to be a
>>>>nightmare - perhaps i'm just too old and fixed in my ways
>>>>>
>>>>>
>>>>"Patrice" <http://www.chez.com/scribe/wrote in message
>>>>news:51**********************************@ microsoft.com...
>>>>>An array is basically a pointer so the Len is not correct.
>>>>>>
>>>>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short
>>>>>to read your data and possibly to copy in the final array (it
>>>>>might be needed anyway as I'm not sure if .NET arrays and VB
>>>>>arrays are storing data using the same ordering).
>>>>>>
>>>>>Another option would be to compute the record length
>>>>>(Runtime.InteropServices.Marhsl.SizeOf(Ge tType(Short))*x.Length)
>>>>>>
>>>>>Another option could be to read each member, you can add a method
>>>>>to your structure to do add (youll need just the overall size, is
>>>>>this a constant in your case ?) and AFAIK datta are read based on
>>>>>the length of the receiving object (depends also how is was done
>>>>>in VB I suppose).
>>>>>>
>>>>>Your best bet would be likely to create a small test case using
>>>>>VB and reading use VB.NET wiht easy checkable values to test and
>>>>>diagnose possible read/write problems more easily...
>>>>>>
>>>>>--
>>>>>Patrice
>>>>>>
>>>>>"John" <no***************@nothing.coma écrit dans le message de
>>>>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>>>>Hi
>>>>>>>
>>>>>>This .net is driving me crazy!!
>>>>>>>
>>>>>>In VB6 I had a type which contained a couple of
>>>>>>multi-dimentional arrays which i used to create and read
>>>>>>records:
>>>>>>>
>>>>>>Type AAA
>>>>>>:
>>>>>>Array1(10,10,2) as Integer
>>>>>>Array2(20,20,4) as Integer
>>>>>>:
>>>>>>End Type
>>>>>>>
>>>>>>I'm trying to get vb8 set up so that i can use the same files
>>>>>>and use the fileopen method to randomly access the file data etc
>>>>>>>
>>>>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions
>>>>>>so i cannot declare it correctly in the structure declaration.
>>>>>>>
>>>>>>What i have done is:
>>>>>>>
>>>>>>Structure z
>>>>>>:
>>>>>>dim Array1(,,) as short
>>>>>>dim Array2(,,) as short
>>>>>>:
>>>>>>End Structure
>>>>>>>
>>>>>>>
>>>>>>Dim x as z
>>>>>>I have then tried to Redim in an initialation so:
>>>>>>>
>>>>>>>
>>>>>>redim x.array1(10,10,2)
>>>>>>redim x.array2(20,20,4)
>>>>>>>
>>>>>>But when i go to get the record length Len(x) it is totally
>>>>>>wrong
>>>>>>>
>>>>>>Is there any way out of this mess so i can use my original
>>>>>>record structures with openfile and random access? Why does
>>>>>>vbfixedarray only allow 2 dementions?????
>>>>>>>
>>>>>>Cheers
>>>>>>John
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Jul 11 '08 #22
The record holds spacial (2d and 3d) information on objects, i nearly put
the date time in as well as the 4th dimension. I will try your method of
accessing to see if that works ok - thanks for your help by the way. I may
use this as a temporary fix and use vb6 to read and write the information
into a different structure so i can use the vb8 more sensibly
"Patrice" <http://www.chez.com/scribe/wrote in message
news:AE**********************************@microsof t.com...
Try :

Structure SatLocation
Public origin As Short
Public _locationfixed As Short 'Boolean
Public _timefixed As Short 'Boolean
Public numberofsets As Short
<VBFixedArray(101 * 11 * 3 - 1)Public _xcoords() As Single
<VBFixedArray(101 * 11 * 3 - 1)Public _ycoords() As Single
Public stamp As Date

' Expose _ members as properties (see previous post for 3D arrays)
' TODO
End Structure

If I write a single record in VB6 and in VB9 it produces the same size on
disk. Members beginning with _ should be exposed using a property (seems
the cullprit were boolean values that are not using the same size)...

BTW I'm not sure what exactly are xcoords and ycoords but they could be
perhaps replaced by something that would be the same overall size but that
could be more handy such as an array of structure especially for the later
component. What are those 3 last values. Are they more handy addressed by
an index array rather than by a name (i.e. it could be MyCoords(100,2).x,
MyCoords(100,2).y, MyCoords(100,2).z and could be exposed also as
MyCoords(100,2).XYZ(0) if really needed the you would likely fit the 2 D
array limitation and wouldn't need any more the "exposed as a propery"
workaround....

Hope it helps.

--
Patrice
Jul 11 '08 #23
However when i do a FileGet(fileno, gamecoords, 1) on this record it
fails.
Have you tried the first step that would be in my view to write a single
record and check the size of the resulting file is 26680. It's a bit weird
you don't seem to have the boolean issue (are you still using Boolean rather
than Short ?)...

You could add some code such as

Debug.Assert(FileLen(File) Mod 26680 = 0)

So that it will fails in debug mode if the file size is not a multiple of
the record size...

I tried reading and it looks fine here... Do you have a single record in
your file ? Is the file size 26680 ?

--
Patrice

Jul 11 '08 #24

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comwrote in message
news:eQ**************@TK2MSFTNGP06.phx.gbl...
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:3r******************************@comcast.com. ..
>On 2008-07-10, John <no***************@nothing.comwrote:

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier

...and he's not familiar with the framework because the help system sucks
like a hoover.
>then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique
control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1
is

256... and we can see "2 doesn't apply" from the over-bloated, "feature
rich" (aka bug fest) apps people create with dotNet.
>handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

...and, you're saying that's not possible in VB5/6? If so, you may not be
as "great" as you assume.
>>
Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

Too bad that's not VB syntax. It's B#... I've been using basic and
assembler since 1981 and basic has *never* used curly braces. That's
"C".... plus, when the app is done, the code is readable in basic (and
assembler)... not that framework/linq/xml crap.... guess what... linq or
any variant of SQL is *NOT* part of any basic language that makes sense.
That's SQL syntax and should stay as such. No use adding hundreds of
keywords to an already over-bloated environment
> ..

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)

Very readable.... NOT
>>
As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM

...so, it worked. Which version(s) of the framework do your users need to
download? Microsoft surely doesn't make things easier on the developer.
That went away when VS6 did... and, if the whole mess is so freaking
"wonderful", why do they have to give it away free? You can still buy
legit copies of VS6, but be prepared to pay more than VS2008 costs... but,
if you want what you pay for, grab VS6

Even after... what... 7? 8 Years? No one knows what to call this "B#"...
is it VB.Net? is it VB#? How about B#? or maybe it's VB8? VB9? What ever.
Have fun.
>and so it has a lot of COM'isms - such as SafeArrays - and so in some
ways is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then

Yeah... or maybe just write the thing in VB6 and go on to the next job,
eh?

But, like I said... you guys can have these freaking groups.

Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem()
{Me.SongCounts, Me.CurrentlyPlayingTxt})

some code out of a designer.vb file. Now it may only be me the I see curly
brackets. Before you harangue people it would be best to check what you
say. This forum should be constructive not a place to thump your chest.

LS

Jul 11 '08 #25
"Lloyd Sheen" <a@b.cwrote in message
news:uN**************@TK2MSFTNGP05.phx.gbl...
>
>Too bad that's not VB syntax. It's B#... I've been using basic and
assembler since 1981 and basic has *never* used curly braces. That's

Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem()
{Me.SongCounts, Me.CurrentlyPlayingTxt})

some code out of a designer.vb file. Now it may only be me the I see
curly brackets. Before you harangue people it would be best to check what
you
Yeah... a B# designer file. How does that relate to my statement? I said
BASIC, in case you missed that... not this "C Wannabe"
say. This forum should be constructive not a place to thump your chest.
boo hoo. How about *you* reading more carefully before jumping in, eh?
Jul 11 '08 #26
On 2008-07-11, Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:3r******************************@comcast.com. ..
>On 2008-07-10, John <no***************@nothing.comwrote:

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier

...and he's not familiar with the framework because the help system sucks
like a hoover.
Please! And VB6's doesn't? MS help has sucked for years - fortunately,
there's this thing called the Internet....
>then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is

256... and we can see "2 doesn't apply" from the over-bloated, "feature
rich" (aka bug fest) apps people create with dotNet.
As opposed to the "feature rich (aka bug fest)" apps in VB6? You know, VB in
general has a bad rep for a reason. It has more to do with the quality of the
coder, then tool.
>handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

...and, you're saying that's not possible in VB5/6? If so, you may not be as
"great" as you assume.
Duh, I said that was one of the reasons for control arrays? In VB.NET, they
don't have to be a control array and they don't have to be the same type. Or
are you claiming that you can have the same event procedure handle the
TextChanged event of a combobox and a textbox in VB6?
>>
Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

Too bad that's not VB syntax. It's B#... I've been using basic and assembler
since 1981 and basic has *never* used curly braces.
VB never had array or variable initialization on the same line before
either... A feature was added, and a syntax was chosen. Get over it.
That's "C".... plus,
when the app is done, the code is readable in basic (and assembler)... not
that framework/linq/xml crap.... guess what... linq or any variant of SQL is
*NOT* part of any basic language that makes sense.
You don't like LINQ - don't use it.
That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment
Your oppinion.
> ..

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)

Very readable.... NOT
What? As opposed to:

Dim theButton As Button
theButton = buttons(btnIndex)

Sorry, but I think I like the one line rather then two bit.
>>
As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM

...so, it worked.
Didn't say or imply that it didn't.
Which version(s) of the framework do your users need to
download?
Which ever version my app needs. That's sort of a stupid question - how many
Visual Basic runtimes are there? Oh, yeah one for every version.... And,
well were at it lets have a discussion about binary compatability, and dll
hell.
Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking "wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want what
you pay for, grab VS6
They give it away for very good reasons. VS's current competition is almost
all FREE. It's a market difference, and not a reflection on the quality of
the product.
Even after... what... 7? 8 Years? No one knows what to call this "B#"... is
it VB.Net? is it VB#? How about B#? or maybe it's VB8? VB9? What ever. Have
fun.
>and so it has a lot of COM'isms - such as SafeArrays - and so in some ways
is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then

Yeah... or maybe just write the thing in VB6 and go on to the next job, eh?
LOL... Yeah right. VB6 was a great tool in it's day, but compared to .NET
it's a toy. To do anything of more then average complexity requires jumping
through some major hoops, which often if not done properly lead to crashes and
hard to find instabilities. I can't tell you how often I read posts over in
the classic group that have long complicated answers delving deep in to the
API, that are solved in .NET apps in a couple of lines of code. But, if you
like dealing in complexity (aka bug riddled apps) then by all means, keep
clinging to your out of date toy environment...
But, like I said... you guys can have these freaking groups.
Thank you, your too kind.

--
Tom Shelton
Jul 11 '08 #27

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comwrote in message
news:uL**************@TK2MSFTNGP04.phx.gbl...
"Lloyd Sheen" <a@b.cwrote in message
news:uN**************@TK2MSFTNGP05.phx.gbl...
>>
>>Too bad that's not VB syntax. It's B#... I've been using basic and
assembler since 1981 and basic has *never* used curly braces. That's

Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem()
{Me.SongCounts, Me.CurrentlyPlayingTxt})

some code out of a designer.vb file. Now it may only be me the I see
curly brackets. Before you harangue people it would be best to check
what you

Yeah... a B# designer file. How does that relate to my statement? I said
BASIC, in case you missed that... not this "C Wannabe"
>say. This forum should be constructive not a place to thump your chest.

boo hoo. How about *you* reading more carefully before jumping in, eh?
As far as I know this is a VB.NET group and curly brackets are part of the
syntax. Grow up.

LS

Jul 11 '08 #28
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:j-******************************@comcast.com...
On 2008-07-11, Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>>
...and he's not familiar with the framework because the help system sucks
like a hoover.

Please! And VB6's doesn't? MS help has sucked for years - fortunately,
there's this thing called the Internet....
Yeah... in dotNet, the internet is required. Not so for VB6 and its version
of MSDN.... but, it makes sense the internet's required since MS
specifically added .NET to the name. It's a web app generator. Now, if I
were creating web apps, or even apps for a mobile device, I surely wouldn't
use VB5/6... but for desktop apps I surely wouldn't want to use dotNet.
Duh, I said that was one of the reasons for control arrays? In VB.NET,
they
don't have to be a control array and they don't have to be the same type.
Or
are you claiming that you can have the same event procedure handle the
TextChanged event of a combobox and a textbox in VB6?
ummm... yes I am... I'm not sure why this is such a surprise. Have you never
coded a sub to be called from multiple places? What difference does it make
where the change event's coming from, or even what control fired it? If
that's so important, pass the control to the sub. No big deal. geez.
>Too bad that's not VB syntax. It's B#... I've been using basic and
assembler
since 1981 and basic has *never* used curly braces.

VB never had array or variable initialization on the same line before
either... A feature was added, and a syntax was chosen. Get over it.
Yeah, because it makes the code unreadable. My enter key works perfectly and
I use it all the time.

Dim i As Integer : I = 10 'is perfectly valid code in VB3,4,5,6 but no one
uses that syntax because it's unreadable and (or should I say AndAlso) leads
to bugs.

While I'm at it, this "+=" and similar crap they've added to make C
programmers more comfortable. What a mess that is. I can't believe people
would rather save 2 freaking keystrokes than have easy to read code... but,
I guess when you're in dotNet, every keystroke you can save counts, right?
>*NOT* part of any basic language that makes sense.

You don't like LINQ - don't use it.
Thanks for the option... Don't like dotBloat either... so I don't use it.
HTH
>That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment

Your oppinion.
Mine and about 5 million others, yep.
>>
Very readable.... NOT

What? As opposed to:

Dim theButton As Button
theButton = buttons(btnIndex)

Sorry, but I think I like the one line rather then two bit.
If that was supposed to be VB syntax, you forgot the Set keyword.. the code
you posted would attempt to pass the default property of those controls back
and forth.

Set theButton = buttons(btnIndex)
>Which version(s) of the framework do your users need to
download?

Which ever version my app needs. That's sort of a stupid question - how
many
Visual Basic runtimes are there? Oh, yeah one for every version.... And,
well were at it lets have a discussion about binary compatability, and dll
hell.
Check these groups. How many people say they've set their app for 2.0 but
the installation forces them to install 3.5?

If you're having problems with Binary Compatibility and DLL Hell after all
these years, I'm very sorry. Most of us have figured out how to deal with
those problems.
>Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking
"wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want
what
you pay for, grab VS6

They give it away for very good reasons. VS's current competition is
almost
all FREE. It's a market difference, and not a reflection on the quality
of
the product.
In your opinion.
>>
Yeah... or maybe just write the thing in VB6 and go on to the next job,
eh?

LOL... Yeah right. VB6 was a great tool in it's day, but compared to
.NET
it's a toy. To do anything of more then average complexity requires
jumping
A toy... yep. One that helped MS "rule the world" in the 90's. btw, try
pasting a block of text in anything resembling an immediate window... what
do you see? What ever it is, it's not what you pasted... now try selecting
that block and pasting into the code window... didn't work at all, you say?
Didn't think so.

Now, try looking at only one procedure in your app.... collapse everything
yet? Can you name a single app in the world that requires its users to edit
text in a treeview? Without an option to turn it off? How about an option to
view a single procedure at a time, without jumping through those dreadful
hoops. Ain't gonna happen? That's because the design team doesn't care. It's
their way or the highway.
through some major hoops, which often if not done properly lead to crashes
and
hard to find instabilities. I can't tell you how often I read posts over
in
Hard to find instabilities... and you're questioning someone elses coding
abilities? mmmkay. What ever... btw... in the computer world, if *anything*
isn't "done properly", you'll get the same results.
the classic group that have long complicated answers delving deep in to
the
API, that are solved in .NET apps in a couple of lines of code. But, if
you
like dealing in complexity (aka bug riddled apps) then by all means, keep
clinging to your out of date toy environment...
Thanks for that. I appreciate that you've allowed me to continue to work in
VB6... what happened when Vista was released? Oh yeah... people were forced
to throw their pre-2005 dotNet stuff away... VB6 still has support until
Win2008 server dies... what is that... 12 more years?

Wasn't Vista supposed to be "The dotNet OS"?... yeah, 2% dotNet, if that.
>But, like I said... you guys can have these freaking groups.

Thank you, your too kind.
You're welcome... ya' know... after all of the dotNet trolls going to the
VB6 groups and spouting their "evangelist" crap, I thought you guys might
want some of the same medicine... I'll pop in and rattle a few cages now and
then.... that is, if you don't mind... if you do mind, I can show you how to
block senders, if that helps.

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.

Have fun... check in next week... same time, same channel.
Jul 11 '08 #29
"Lloyd Sheen" <a@b.cwrote in message
news:uc**************@TK2MSFTNGP03.phx.gbl...
>
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
Jul 11 '08 #30
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.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:BA**********************************@microsof t.com...
So for the array issue I tried the following :

VB6 side Ive got a x(1,2,3) integer array...

VB.NET side I've got the following structure :

<VBFixedArray(23)Public _x() As Short

Public Property x(ByVal i As Integer, ByVal j As Integer, ByVal k As
Integer) As Short
Get
Return _x(i + j * 2 + k * 2 * 3)
End Get
Set(ByVal value As Short)
' TODO
End Set
End Property

That is :

- the _x array is a single dimension array whose size is the same as the
3D array VB6 side. It allows to read the array using FileGet

- I expose this array as a 3D array using a property so that x looks like
a 3D array... (each cell is at a position so that each index uses the
number of elements for all the previous indices as an offset)

It should be similar enough to VB6 to be usable while watijgn perhaps to
switch to something better if another idea or a later update gives better
support...

--
Patrice

"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : #6**************@TK2MSFTNGP03.phx.gbl...
>Hi Patrice

My overall intent is to convert an existing VB6 application into vb.net
so I can still use multiple records I created in the new application. I
have managed to handle all the other type conversions so vb net handles
then using the fileopen, fileget, fileput but the following record as
stopped the conversion in its tracks because of the multidementional
array aspect.

The vb6 type structure is as follows:

Type satlocation

origin As Integer

locationfixed As Boolean

timefixed As Boolean

numberofsets As Integer

xcoords(100, 10, 2) As Single

ycoords(100, 10, 2) As Single

stamp As Date

End Type

What I need to do is to be able to read and write to randomly to existing
data in the above record set that was created under vb6 - as you can see
there are literally thousands of cords that I certainly do not want to
input again, so basically I need to use the this same record set.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:9F**********************************@microso ft.com...
>>What is the overall intent ? It's true that VB.NET is different. For
example the way to persists data is totally different so if you need to
read legacy data, it might be usefull to consider the other options that
.NET could bring to the table ("serialization" i..e the ability to
persist data structure to disk or using datasets that are a in memory db
representation (suitable only for small amouts of data) or a real db.

Let me know if you are still heading to VB.NET I'll try to give this a
closer look with a working sample...
--
Patrice
"John" <no***************@nothing.coma écrit dans le message de groupe
de discussion : uF*************@TK2MSFTNGP04.phx.gbl...
OK forget it - there is a more serious problem with this, it seems that
vb8 does not support arrays declared like arr1(10,10,10) because when
you try to do the Fileput it just gives an error saying only 2
dimentional arrays are supported - what a load of tat!!!

i think i'll go back to vb6 that was a true RAD piece of kit, my only
other option it seems is to scrap all my hundreds of records and then
design the structure in vb8 so that it is something like

dim arr1(100,2)
dim arr2(100,2)
:
:
dim arr100(100,2)
just to get the same thing as dim arr1(100,100,2)

"John" <no***************@nothing.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl. ..
Ok i've got the Runtime.InteropServices.... bit to work
>
I've done it on all the elements of the structure and added them
together but i'm 4 bytes out?
>
I suppose i could just hard code the record length - but it seems a
very poor way of doing things.
>
>
"John" <no***************@nothing.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl.. .
>thanks Patrice for that - i considered doing a fudge but the values
>are out so there seems to be an overhead in the array structure
>differences in the vb6 and vb8 - the 2 values do not come out the
>same anyway- they are a few hundred bytes different so the chances of
>reading and writing correctly into the old records is zero, and i
>don't fancy spending the rest of my life just trying to fudge
>something that works.
>>
>i tried
>Runtime.InteropServices.Marshal.SizeOf(GetTyp e(Short))*x.Length but
>it just gives me an error saying length is not a member of x so i
>don't know whether this would work or not!!
>>
>god i really hate this vb.net stuff - why is everything such a
>pain? - nothing seems logical (for example, why have a vbfixedarray
>statement that is limited to 2 dimentions?) and why they call it vb
>god knows, i've used vb since the 70's without any problem everything
>i try to do in this turns out to be a nightmare - perhaps i'm just
>too old and fixed in my ways
>>
>>
>"Patrice" <http://www.chez.com/scribe/wrote in message
>news:51**********************************@mic rosoft.com...
>>An array is basically a pointer so the Len is not correct.
>>>
>>A trick could be to use <VBFixedArray(10 * 10 * 4)x() As Short to
>>read your data and possibly to copy in the final array (it might be
>>needed anyway as I'm not sure if .NET arrays and VB arrays are
>>storing data using the same ordering).
>>>
>>Another option would be to compute the record length
>>(Runtime.InteropServices.Marhsl.SizeOf(GetTy pe(Short))*x.Length)
>>>
>>Another option could be to read each member, you can add a method to
>>your structure to do add (youll need just the overall size, is this
>>a constant in your case ?) and AFAIK datta are read based on the
>>length of the receiving object (depends also how is was done in VB I
>>suppose).
>>>
>>Your best bet would be likely to create a small test case using VB
>>and reading use VB.NET wiht easy checkable values to test and
>>diagnose possible read/write problems more easily...
>>>
>>--
>>Patrice
>>>
>>"John" <no***************@nothing.coma écrit dans le message de
>>groupe de discussion : uh**************@TK2MSFTNGP05.phx.gbl...
>>>Hi
>>>>
>>>This .net is driving me crazy!!
>>>>
>>>In VB6 I had a type which contained a couple of multi-dimentional
>>>arrays which i used to create and read records:
>>>>
>>>Type AAA
>>>:
>>>Array1(10,10,2) as Integer
>>>Array2(20,20,4) as Integer
>>>:
>>>End Type
>>>>
>>>I'm trying to get vb8 set up so that i can use the same files and
>>>use the fileopen method to randomly access the file data etc
>>>>
>>>vb8 won't let me use <vbfixedarraywith more than 2 dementions so
>>>i cannot declare it correctly in the structure declaration.
>>>>
>>>What i have done is:
>>>>
>>>Structure z
>>>:
>>>dim Array1(,,) as short
>>>dim Array2(,,) as short
>>>:
>>>End Structure
>>>>
>>>>
>>>Dim x as z
>>>I have then tried to Redim in an initialation so:
>>>>
>>>>
>>>redim x.array1(10,10,2)
>>>redim x.array2(20,20,4)
>>>>
>>>But when i go to get the record length Len(x) it is totally wrong
>>>>
>>>Is there any way out of this mess so i can use my original record
>>>structures with openfile and random access? Why does vbfixedarray
>>>only allow 2 dementions?????
>>>>
>>>Cheers
>>>John
>>>
>>>
>>
>

Jul 11 '08 #31
On 2008-07-11, Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:j-******************************@comcast.com...
>On 2008-07-11, Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>>>
...and he's not familiar with the framework because the help system sucks
like a hoover.

Please! And VB6's doesn't? MS help has sucked for years - fortunately,
there's this thing called the Internet....

Yeah... in dotNet, the internet is required. Not so for VB6 and its version
of MSDN.... but, it makes sense the internet's required since MS
specifically added .NET to the name. It's a web app generator. Now, if I
were creating web apps, or even apps for a mobile device, I surely wouldn't
use VB5/6... but for desktop apps I surely wouldn't want to use dotNet.
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.
>Duh, I said that was one of the reasons for control arrays? In VB.NET,
they
don't have to be a control array and they don't have to be the same type.
Or
are you claiming that you can have the same event procedure handle the
TextChanged event of a combobox and a textbox in VB6?

ummm... yes I am... I'm not sure why this is such a surprise. Have you never
coded a sub to be called from multiple places? What difference does it make
where the change event's coming from, or even what control fired it? If
that's so important, pass the control to the sub. No big deal. geez.
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.

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.
>>Too bad that's not VB syntax. It's B#... I've been using basic and
assembler
since 1981 and basic has *never* used curly braces.

VB never had array or variable initialization on the same line before
either... A feature was added, and a syntax was chosen. Get over it.

Yeah, because it makes the code unreadable. My enter key works perfectly and
I use it all the time.
You think:

Dim i As Integer = 10

Is unreadable? Wow.
>
Dim i As Integer : I = 10 'is perfectly valid code in VB3,4,5,6 but no one
uses that syntax because it's unreadable and (or should I say AndAlso) leads
to bugs.
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.
>
While I'm at it, this "+=" and similar crap they've added to make C
programmers more comfortable. What a mess that is. I can't believe people
would rather save 2 freaking keystrokes than have easy to read code... but,
I guess when you're in dotNet, every keystroke you can save counts, right?
Again, you don't like it - don't use it, but don't try to force your strange
sesne of readability on others.
>>*NOT* part of any basic language that makes sense.

You don't like LINQ - don't use it.

Thanks for the option... Don't like dotBloat either... so I don't use it.
HTH
Again, a valid option. Hope it works for you, when the rest of the world
moves on to distributed systems and 64-bit apps....
>>That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment

Your oppinion.

Mine and about 5 million others, yep.
Goody for them.
>>>
Very readable.... NOT

What? As opposed to:

Dim theButton As Button
theButton = buttons(btnIndex)

Sorry, but I think I like the one line rather then two bit.

If that was supposed to be VB syntax, you forgot the Set keyword.. the code
you posted would attempt to pass the default property of those controls back
and forth.

Set theButton = buttons(btnIndex)
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.

Thanks goodness, I don't have to deal with that mess anymore...
>>Which version(s) of the framework do your users need to
download?

Which ever version my app needs. That's sort of a stupid question - how
many
Visual Basic runtimes are there? Oh, yeah one for every version.... And,
well were at it lets have a discussion about binary compatability, and dll
hell.

Check these groups. How many people say they've set their app for 2.0 but
the installation forces them to install 3.5?
Because they screwed up their installer. What does that have to do with .NET?
If you're having problems with Binary Compatibility and DLL Hell after all
these years, I'm very sorry. Most of us have figured out how to deal with
those problems.
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.
>>Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking
"wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want
what
you pay for, grab VS6

They give it away for very good reasons. VS's current competition is
almost
all FREE. It's a market difference, and not a reflection on the quality
of
the product.

In your opinion.
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.
>>>
Yeah... or maybe just write the thing in VB6 and go on to the next job,
eh?

LOL... Yeah right. VB6 was a great tool in it's day, but compared to
.NET
it's a toy. To do anything of more then average complexity requires
jumping

A toy... yep. One that helped MS "rule the world" in the 90's. btw, try
pasting a block of text in anything resembling an immediate window... what
do you see? What ever it is, it's not what you pasted... now try selecting
that block and pasting into the code window... didn't work at all, you say?
Didn't think so.
What are you talking about?
Now, try looking at only one procedure in your app.... collapse everything
yet? Can you name a single app in the world that requires its users to edit
text in a treeview? Without an option to turn it off? How about an option to
view a single procedure at a time, without jumping through those dreadful
hoops. Ain't gonna happen? That's because the design team doesn't care. It's
their way or the highway.
Again, it does allow you turn off outlining. And yes, I have collapsed to
definitions.... Ctrl+M,O.

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.
>through some major hoops, which often if not done properly lead to crashes
and
hard to find instabilities. I can't tell you how often I read posts over
in

Hard to find instabilities... and you're questioning someone elses coding
abilities? mmmkay. What ever... btw... in the computer world, if *anything*
isn't "done properly", you'll get the same results.
When did I question your's or anyone elses abilities? You seem to take all fo
this very personal and are reading things into my comments that I certainly
did not say.... I like how you focus on the tail end of hte comment, instead
on the important point - you know, the part about making anything of more then
average complexity a major undertaking?
>the classic group that have long complicated answers delving deep in to
the
API, that are solved in .NET apps in a couple of lines of code. But, if
you
like dealing in complexity (aka bug riddled apps) then by all means, keep
clinging to your out of date toy environment...

Thanks for that. I appreciate that you've allowed me to continue to work in
VB6... what happened when Vista was released? Oh yeah... people were forced
to throw their pre-2005 dotNet stuff away...
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.
Unless your talking about the DEP installation failure? There is a work
around for that you know....
VB6 still has support until
Win2008 server dies... what is that... 12 more years?

Wasn't Vista supposed to be "The dotNet OS"?... yeah, 2% dotNet, if that.
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.
>>But, like I said... you guys can have these freaking groups.

Thank you, your too kind.

You're welcome... ya' know... after all of the dotNet trolls going to the
VB6 groups and spouting their "evangelist" crap, I thought you guys might
want some of the same medicine... I'll pop in and rattle a few cages now and
then.... that is, if you don't mind... if you do mind, I can show you how to
block senders, if that helps.
Oh, by all means keep it up. I don't mind a little lively conversation now
and again :)
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.

Have fun... check in next week... same time, same channel.
See you latter.

--
Tom Shelton
Jul 11 '08 #32
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:bt******************************@comcast.com. ..
>>

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.
>>Duh, I said that was one of the reasons for control arrays? In VB.NET,
they
don't have to be a control array and they don't have to be the same
type.
Or
are you claiming that you can have the same event procedure handle the
TextChanged event of a combobox and a textbox in VB6?

ummm... yes I am... I'm not sure why this is such a surprise. Have you
never
coded a sub to be called from multiple places? What difference does it
make
where the change event's coming from, or even what control fired it? If
that's so important, pass the control to the sub. No big deal. geez.

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.
>>
Yeah, because it makes the code unreadable. My enter key works perfectly
and
I use it all the time.

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.
>Dim i As Integer : I = 10 'is perfectly valid code in VB3,4,5,6 but no
one
uses that syntax because it's unreadable and (or should I say AndAlso)
leads
to bugs.

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.
>While I'm at it, this "+=" and similar crap they've added to make C
programmers more comfortable. What a mess that is. I can't believe people
would rather save 2 freaking keystrokes than have easy to read code...
but,
I guess when you're in dotNet, every keystroke you can save counts,
right?

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.
>>>
Your oppinion.

Mine and about 5 million others, yep.

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.
>Set theButton = buttons(btnIndex)

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?
>>
Check these groups. How many people say they've set their app for 2.0 but
the installation forces them to install 3.5?

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?
>If you're having problems with Binary Compatibility and DLL Hell after
all
these years, I'm very sorry. Most of us have figured out how to deal with
those problems.

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.
>A toy... yep. One that helped MS "rule the world" in the 90's. btw, try
pasting a block of text in anything resembling an immediate window...
what
do you see? What ever it is, it's not what you pasted... now try
selecting
that block and pasting into the code window... didn't work at all, you
say?
Didn't think so.

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.
>>
Thanks for that. I appreciate that you've allowed me to continue to work
in
VB6... what happened when Vista was released? Oh yeah... people were
forced
to throw their pre-2005 dotNet stuff away...

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.
>>
Wasn't Vista supposed to be "The dotNet OS"?... yeah, 2% dotNet, if that.

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 <gLOL... that was the entire sales pitch... some talk... funny.
Jul 11 '08 #33
Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
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).

--
J.B. Moreno
Jul 12 '08 #34
"Armin Zingler" <az*******@freenet.dewrote in message
news:eN**************@TK2MSFTNGP02.phx.gbl...
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comschrieb
>re-wrote VB basically from the ground up

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"
Jul 14 '08 #35
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comschrieb
"Armin Zingler" <az*******@freenet.dewrote in message
news:eN**************@TK2MSFTNGP02.phx.gbl...
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comschrieb
re-wrote VB basically from the ground up
Luckily they did. Finally got rid of all the hacks.

...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

Jul 14 '08 #36
If you don't miss control arrays, look at what I had to do to account
for them being missing (caution, this is ugly). Could have been handled
in about 3 statements in VB6! I have 42 controls so 84 clauses in the
"Handles" string to catch all of the click and ValueChanged events. Then
this has to call another routine after figuring out who called this one.
DUMB!!!!!! Here is what the "VB Team" has done for us:

Thanks?

-----------------------------------------------

Sub AlarmChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Alarm1.ValueChanged, Alarm2.ValueChanged, Alarm3.ValueChanged,
Alarm4.ValueChanged, Alarm5.ValueChanged, _
Alarm6.ValueChanged, Alarm7.ValueChanged, Alarm8.ValueChanged,
Alarm9.ValueChanged, Alarm10.ValueChanged, _
Alarm11.ValueChanged, Alarm12.ValueChanged, Alarm13.ValueChanged,
Alarm14.ValueChanged, Alarm15.ValueChanged, _
Alarm16.ValueChanged, Alarm17.ValueChanged, Alarm18.ValueChanged,
Alarm19.ValueChanged, Alarm20.ValueChanged, _
Alarm21.ValueChanged, Alarm22.ValueChanged, Alarm23.ValueChanged,
Alarm24.ValueChanged, Alarm25.ValueChanged, _
Alarm26.ValueChanged, Alarm27.ValueChanged, Alarm28.ValueChanged,
Alarm29.ValueChanged, Alarm30.ValueChanged, _
Alarm31.ValueChanged, Alarm32.ValueChanged, Alarm33.ValueChanged,
Alarm34.ValueChanged, Alarm35.ValueChanged, _
Alarm36.ValueChanged, Alarm37.ValueChanged, Alarm38.ValueChanged,
Alarm39.ValueChanged, Alarm30.ValueChanged, _
Alarm41.ValueChanged, Alarm42.ValueChanged, _
Alarm1.Click, Alarm2.Click, Alarm3.Click, Alarm4.Click, Alarm5.Click,
_
Alarm6.Click, Alarm7.Click, Alarm8.Click, Alarm9.Click, Alarm10.Click,
_
Alarm11.Click, Alarm12.Click, Alarm13.Click, Alarm14.Click,
Alarm15.Click, _
Alarm16.Click, Alarm17.Click, Alarm18.Click, Alarm19.Click,
Alarm20.Click, _
Alarm21.Click, Alarm22.Click, Alarm23.Click, Alarm24.Click,
Alarm25.Click, _
Alarm26.Click, Alarm27.Click, Alarm28.Click, Alarm29.Click,
Alarm30.Click, _
Alarm31.Click, Alarm32.Click, Alarm33.Click, Alarm34.Click,
Alarm35.Click, _
Alarm36.Click, Alarm37.Click, Alarm38.Click, Alarm39.Click,
Alarm30.Click, _
Alarm41.Click, Alarm42.Click

If bIgnoreClicks Then Exit Sub

If sender.Equals(Alarm1) Then : CheckAlarmVsWarn(Warn1, Alarm1) :
Exit Sub
ElseIf sender.Equals(Alarm2) Then : CheckAlarmVsWarn(Warn2, Alarm2)
: Exit Sub
ElseIf sender.Equals(Alarm3) Then : CheckAlarmVsWarn(Warn3, Alarm3)
: Exit Sub
ElseIf sender.Equals(Alarm4) Then : CheckAlarmVsWarn(Warn4, Alarm4)
: Exit Sub
ElseIf sender.Equals(Alarm5) Then : CheckAlarmVsWarn(Warn5, Alarm5)
: Exit Sub
ElseIf sender.Equals(Alarm6) Then : CheckAlarmVsWarn(Warn6, Alarm6)
: Exit Sub
ElseIf sender.Equals(Alarm7) Then : CheckAlarmVsWarn(Warn7, Alarm7)
: Exit Sub
ElseIf sender.Equals(Alarm8) Then : CheckAlarmVsWarn(Warn8, Alarm8)
: Exit Sub
ElseIf sender.Equals(Alarm9) Then : CheckAlarmVsWarn(Warn9, Alarm9)
: Exit Sub
ElseIf sender.Equals(Alarm10) Then : CheckAlarmVsWarn(Warn10,
Alarm10) : Exit Sub
ElseIf sender.Equals(Alarm11) Then : CheckAlarmVsWarn(Warn11,
Alarm11) : Exit Sub
ElseIf sender.Equals(Alarm12) Then : CheckAlarmVsWarn(Warn12,
Alarm12) : Exit Sub
ElseIf sender.Equals(Alarm13) Then : CheckAlarmVsWarn(Warn13,
Alarm13) : Exit Sub
ElseIf sender.Equals(Alarm14) Then : CheckAlarmVsWarn(Warn14,
Alarm14) : Exit Sub
ElseIf sender.Equals(Alarm15) Then : CheckAlarmVsWarn(Warn15,
Alarm15) : Exit Sub
ElseIf sender.Equals(Alarm16) Then : CheckAlarmVsWarn(Warn16,
Alarm16) : Exit Sub
ElseIf sender.Equals(Alarm17) Then : CheckAlarmVsWarn(Warn17,
Alarm17) : Exit Sub
ElseIf sender.Equals(Alarm18) Then : CheckAlarmVsWarn(Warn18,
Alarm18) : Exit Sub
ElseIf sender.Equals(Alarm19) Then : CheckAlarmVsWarn(Warn19,
Alarm19) : Exit Sub
ElseIf sender.Equals(Alarm20) Then : CheckAlarmVsWarn(Warn20,
Alarm20) : Exit Sub
ElseIf sender.Equals(Alarm21) Then : CheckAlarmVsWarn(Warn21,
Alarm21) : Exit Sub
ElseIf sender.Equals(Alarm22) Then : CheckAlarmVsWarn(Warn22,
Alarm22) : Exit Sub
ElseIf sender.Equals(Alarm23) Then : CheckAlarmVsWarn(Warn23,
Alarm23) : Exit Sub
ElseIf sender.Equals(Alarm24) Then : CheckAlarmVsWarn(Warn24,
Alarm24) : Exit Sub
ElseIf sender.Equals(Alarm25) Then : CheckAlarmVsWarn(Warn25,
Alarm25) : Exit Sub
ElseIf sender.Equals(Alarm26) Then : CheckAlarmVsWarn(Warn26,
Alarm26) : Exit Sub
ElseIf sender.Equals(Alarm27) Then : CheckAlarmVsWarn(Warn27,
Alarm27) : Exit Sub
ElseIf sender.Equals(Alarm28) Then : CheckAlarmVsWarn(Warn28,
Alarm28) : Exit Sub
ElseIf sender.Equals(Alarm29) Then : CheckAlarmVsWarn(Warn29,
Alarm29) : Exit Sub
ElseIf sender.Equals(Alarm30) Then : CheckAlarmVsWarn(Warn30,
Alarm30) : Exit Sub
ElseIf sender.Equals(Alarm31) Then : CheckAlarmVsWarn(Warn31,
Alarm31) : Exit Sub
ElseIf sender.Equals(Alarm32) Then : CheckAlarmVsWarn(Warn32,
Alarm32) : Exit Sub
ElseIf sender.Equals(Alarm33) Then : CheckAlarmVsWarn(Warn33,
Alarm33) : Exit Sub
ElseIf sender.Equals(Alarm34) Then : CheckAlarmVsWarn(Warn34,
Alarm34) : Exit Sub
ElseIf sender.Equals(Alarm35) Then : CheckAlarmVsWarn(Warn35,
Alarm35) : Exit Sub
ElseIf sender.Equals(Alarm36) Then : CheckAlarmVsWarn(Warn36,
Alarm36) : Exit Sub
ElseIf sender.Equals(Alarm37) Then : CheckAlarmVsWarn(Warn37,
Alarm37) : Exit Sub
ElseIf sender.Equals(Alarm38) Then : CheckAlarmVsWarn(Warn38,
Alarm38) : Exit Sub
ElseIf sender.Equals(Alarm39) Then : CheckAlarmVsWarn(Warn39,
Alarm39) : Exit Sub
ElseIf sender.Equals(Alarm40) Then : CheckAlarmVsWarn(Warn40,
Alarm40) : Exit Sub
ElseIf sender.Equals(Alarm41) Then : CheckAlarmVsWarn(Warn41,
Alarm41) : Exit Sub
ElseIf sender.Equals(Alarm42) Then : CheckAlarmVsWarn(Warn42,
Alarm42) : Exit Sub
End If

End SubOn Thu, 10 Jul 2008 17:15:22 -0500, in
microsoft.public.dotnet.languages.vb Tom Shelton
<to*********@comcastXXXXXXX.netwrote:
>On 2008-07-10, John <no***************@nothing.comwrote:
>glad to know its not just me, i would not even have considered using vb8 but
i do like the new updated appearance and i was worried that eventually vb6
would not work with microsofts operating system updates.

practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly the
whole day trying to achieve something that cannot be done simply (the best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build them
at run time and spend hours trying to get the layout correct, - printing -
you cannot easily specify a new page without going into a recursive print
handler which takes more time trying to handle your printing, etc etc all
simple stuff but a nightmare in this product.

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH easier
then VB6. I know, I spent years doing VB work. I'm not claiming every thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

' you can do this in the ide - just select all of the controls you want, go
' to the event tab in the properties window and add the handler - the ide will
' automatically add the handles list :)
Private Sub Button_Click (ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click

Dim clickedButton As Button = DirectCast (sender, Button)
' do button stuff
End Sub

There are times that using index's to access a control are helpful... And
even that is a fairly simple task.

Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

...

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
' do cool stuff with the button
End Sub
End Class

Or you can index them from the containser controls collection at runtime by
the name:

Dim theButton As Button = DirectCast(Me.Controls("theButton"), Button)

There is no need to dynamically generate controls... You just have to
understand the differences and the capabilites of VB.NET and then you don't
have these types of issues (well, at least not as often).

As for your file issue, I only was half joking about your file access - the
fact is that .NET is a different target platform then VB6. VB6 targeted COM
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways is
not compatable. Personally, if I were you I would create a VB6 component that
would be able to convert the files into a more .NET friendly format and then
access them using the System.IO namespace classes. The FileXXX VB.NET native
functions are crap...
Jul 19 '08 #37
You forgot to add that you can do absolutely everything in VB.NET at
LEAST 2 ways and some of them have more ways than that to do the same
thing. WHY??? Never will know.

It adds to the complexity and makes the IDE and projects, even small
ones take a very long time to load bringing in thousands of those
multiple ways to do one thing. So also thanks for slowing everything
down.

Mike

On Fri, 11 Jul 2008 07:45:49 -0700, in
microsoft.public.dotnet.languages.vb "Ken Halter"
<Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:3r******************************@comcast.com ...
>On 2008-07-10, John <no***************@nothing.comwrote:

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier

...and he's not familiar with the framework because the help system sucks
like a hoover.
>then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is

256... and we can see "2 doesn't apply" from the over-bloated, "feature
rich" (aka bug fest) apps people create with dotNet.
>handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

...and, you're saying that's not possible in VB5/6? If so, you may not be as
"great" as you assume.
>>
Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

Too bad that's not VB syntax. It's B#... I've been using basic and assembler
since 1981 and basic has *never* used curly braces. That's "C".... plus,
when the app is done, the code is readable in basic (and assembler)... not
that framework/linq/xml crap.... guess what... linq or any variant of SQL is
*NOT* part of any basic language that makes sense. That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment
> ..

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)

Very readable.... NOT
>>
As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM

...so, it worked. Which version(s) of the framework do your users need to
download? Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking "wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want what
you pay for, grab VS6

Even after... what... 7? 8 Years? No one knows what to call this "B#"... is
it VB.Net? is it VB#? How about B#? or maybe it's VB8? VB9? What ever. Have
fun.
>and so it has a lot of COM'isms - such as SafeArrays - and so in some ways
is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then

Yeah... or maybe just write the thing in VB6 and go on to the next job, eh?

But, like I said... you guys can have these freaking groups.
Jul 19 '08 #38
I have an app which won't run on any other system. It blows up before
my first line of code runs so I have NO idea what is wrong and NO idea
how to fix it.

I have sent in the dumps but no one has said anything to me. No one can
fix it here or anywhere and seven months later, I STILL cannot
distribute the program to ANYONE and have it run!

How's that for unstable?!?!

Mike

On Fri, 11 Jul 2008 10:16:58 -0700, in
microsoft.public.dotnet.languages.vb "Ken Halter"
<Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:j-******************************@comcast.com...
>On 2008-07-11, Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>>>
...and he's not familiar with the framework because the help system sucks
like a hoover.

Please! And VB6's doesn't? MS help has sucked for years - fortunately,
there's this thing called the Internet....

Yeah... in dotNet, the internet is required. Not so for VB6 and its version
of MSDN.... but, it makes sense the internet's required since MS
specifically added .NET to the name. It's a web app generator. Now, if I
were creating web apps, or even apps for a mobile device, I surely wouldn't
use VB5/6... but for desktop apps I surely wouldn't want to use dotNet.
>Duh, I said that was one of the reasons for control arrays? In VB.NET,
they
don't have to be a control array and they don't have to be the same type.
Or
are you claiming that you can have the same event procedure handle the
TextChanged event of a combobox and a textbox in VB6?

ummm... yes I am... I'm not sure why this is such a surprise. Have you never
coded a sub to be called from multiple places? What difference does it make
where the change event's coming from, or even what control fired it? If
that's so important, pass the control to the sub. No big deal. geez.
>>Too bad that's not VB syntax. It's B#... I've been using basic and
assembler
since 1981 and basic has *never* used curly braces.

VB never had array or variable initialization on the same line before
either... A feature was added, and a syntax was chosen. Get over it.

Yeah, because it makes the code unreadable. My enter key works perfectly and
I use it all the time.

Dim i As Integer : I = 10 'is perfectly valid code in VB3,4,5,6 but no one
uses that syntax because it's unreadable and (or should I say AndAlso) leads
to bugs.

While I'm at it, this "+=" and similar crap they've added to make C
programmers more comfortable. What a mess that is. I can't believe people
would rather save 2 freaking keystrokes than have easy to read code... but,
I guess when you're in dotNet, every keystroke you can save counts, right?
>>*NOT* part of any basic language that makes sense.

You don't like LINQ - don't use it.

Thanks for the option... Don't like dotBloat either... so I don't use it.
HTH
>>That's SQL syntax and
should stay as such. No use adding hundreds of keywords to an already
over-bloated environment

Your oppinion.

Mine and about 5 million others, yep.
>>>
Very readable.... NOT

What? As opposed to:

Dim theButton As Button
theButton = buttons(btnIndex)

Sorry, but I think I like the one line rather then two bit.

If that was supposed to be VB syntax, you forgot the Set keyword.. the code
you posted would attempt to pass the default property of those controls back
and forth.

Set theButton = buttons(btnIndex)
>>Which version(s) of the framework do your users need to
download?

Which ever version my app needs. That's sort of a stupid question - how
many
Visual Basic runtimes are there? Oh, yeah one for every version.... And,
well were at it lets have a discussion about binary compatability, and dll
hell.

Check these groups. How many people say they've set their app for 2.0 but
the installation forces them to install 3.5?

If you're having problems with Binary Compatibility and DLL Hell after all
these years, I'm very sorry. Most of us have figured out how to deal with
those problems.
>>Microsoft surely doesn't make things easier on the developer. That
went away when VS6 did... and, if the whole mess is so freaking
"wonderful",
why do they have to give it away free? You can still buy legit copies of
VS6, but be prepared to pay more than VS2008 costs... but, if you want
what
you pay for, grab VS6

They give it away for very good reasons. VS's current competition is
almost
all FREE. It's a market difference, and not a reflection on the quality
of
the product.

In your opinion.
>>>
Yeah... or maybe just write the thing in VB6 and go on to the next job,
eh?

LOL... Yeah right. VB6 was a great tool in it's day, but compared to
.NET
it's a toy. To do anything of more then average complexity requires
jumping

A toy... yep. One that helped MS "rule the world" in the 90's. btw, try
pasting a block of text in anything resembling an immediate window... what
do you see? What ever it is, it's not what you pasted... now try selecting
that block and pasting into the code window... didn't work at all, you say?
Didn't think so.

Now, try looking at only one procedure in your app.... collapse everything
yet? Can you name a single app in the world that requires its users to edit
text in a treeview? Without an option to turn it off? How about an option to
view a single procedure at a time, without jumping through those dreadful
hoops. Ain't gonna happen? That's because the design team doesn't care. It's
their way or the highway.
>through some major hoops, which often if not done properly lead to crashes
and
hard to find instabilities. I can't tell you how often I read posts over
in

Hard to find instabilities... and you're questioning someone elses coding
abilities? mmmkay. What ever... btw... in the computer world, if *anything*
isn't "done properly", you'll get the same results.
>the classic group that have long complicated answers delving deep in to
the
API, that are solved in .NET apps in a couple of lines of code. But, if
you
like dealing in complexity (aka bug riddled apps) then by all means, keep
clinging to your out of date toy environment...

Thanks for that. I appreciate that you've allowed me to continue to work in
VB6... what happened when Vista was released? Oh yeah... people were forced
to throw their pre-2005 dotNet stuff away... VB6 still has support until
Win2008 server dies... what is that... 12 more years?

Wasn't Vista supposed to be "The dotNet OS"?... yeah, 2% dotNet, if that.
>>But, like I said... you guys can have these freaking groups.

Thank you, your too kind.

You're welcome... ya' know... after all of the dotNet trolls going to the
VB6 groups and spouting their "evangelist" crap, I thought you guys might
want some of the same medicine... I'll pop in and rattle a few cages now and
then.... that is, if you don't mind... if you do mind, I can show you how to
block senders, if that helps.

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.

Have fun... check in next week... same time, same channel.
Jul 19 '08 #39
On Fri, 11 Jul 2008 15:49:32 -0500, in
microsoft.public.dotnet.languages.vb Tom Shelton
<to*********@comcastXXXXXXX.netwrote:
>All of which works in VS as well... What I, thought we were talking about was
the actual quality of the help - not the mechanism for obtaining it.
Well, not quite "all". I get screwy messages from time to time. The
last one I got refers to not being able to use a lamda or query
statement. Try figuring out what a lamda statement is from the help. I
never did! I looked all around and still have no idea what a lamda
statement is and I don't use any query statements or databases in the
entire program so WHAT is it complaining about and WHY can't I find out
what the problem is? Don't know! Never will!

Pressing F1 brings up a LOT of stuff when I really want help on the
control. Sometimes I finally "drill down" to it, sometimes not. And
sometimes it tells me that I don't have the right password for 3 days,
and then starts working again on the fourth day. During that time, it
did not allow me to put in a userid or password and refused to work.
What's that about???? And why did it start working again??? No idea!
Never will know!

We got a lot but we gave back MORE! (single procedure view, procedures
sorted by name, now have completely cryptic "help" messages of no help
at all, SPEED has gone away, both IDE starting and apps starting, SO
MUCH MORE!)

Mike
Jul 19 '08 #40
On Fri, 11 Jul 2008 15:10:08 -0700, in
microsoft.public.dotnet.languages.vb "Ken Halter"
<Ken_Halter@Use_Sparingly_Hotmail.comwrote:
>quality of answer = quality of question
Trouble is, M$ creates the question and THERE IS NO ANSWER!

See previous post about lamda statements (whatever they are) referenced
in a M$ error message.

Mike
Jul 19 '08 #41
<Ju********@home.netschrieb
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

Jul 19 '08 #42
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("Ala rm{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.
<Ju********@home.netwrote in message
news:00********************************@4ax.com...
If you don't miss control arrays, look at what I had to do to account
for them being missing (caution, this is ugly). Could have been handled
in about 3 statements in VB6! I have 42 controls so 84 clauses in the
"Handles" string to catch all of the click and ValueChanged events. Then
this has to call another routine after figuring out who called this one.
DUMB!!!!!! Here is what the "VB Team" has done for us:

Thanks?

-----------------------------------------------

Sub AlarmChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Alarm1.ValueChanged, Alarm2.ValueChanged, Alarm3.ValueChanged,
Alarm4.ValueChanged, Alarm5.ValueChanged, _
Alarm6.ValueChanged, Alarm7.ValueChanged, Alarm8.ValueChanged,
Alarm9.ValueChanged, Alarm10.ValueChanged, _
Alarm11.ValueChanged, Alarm12.ValueChanged, Alarm13.ValueChanged,
Alarm14.ValueChanged, Alarm15.ValueChanged, _
Alarm16.ValueChanged, Alarm17.ValueChanged, Alarm18.ValueChanged,
Alarm19.ValueChanged, Alarm20.ValueChanged, _
Alarm21.ValueChanged, Alarm22.ValueChanged, Alarm23.ValueChanged,
Alarm24.ValueChanged, Alarm25.ValueChanged, _
Alarm26.ValueChanged, Alarm27.ValueChanged, Alarm28.ValueChanged,
Alarm29.ValueChanged, Alarm30.ValueChanged, _
Alarm31.ValueChanged, Alarm32.ValueChanged, Alarm33.ValueChanged,
Alarm34.ValueChanged, Alarm35.ValueChanged, _
Alarm36.ValueChanged, Alarm37.ValueChanged, Alarm38.ValueChanged,
Alarm39.ValueChanged, Alarm30.ValueChanged, _
Alarm41.ValueChanged, Alarm42.ValueChanged, _
Alarm1.Click, Alarm2.Click, Alarm3.Click, Alarm4.Click, Alarm5.Click,
_
Alarm6.Click, Alarm7.Click, Alarm8.Click, Alarm9.Click, Alarm10.Click,
_
Alarm11.Click, Alarm12.Click, Alarm13.Click, Alarm14.Click,
Alarm15.Click, _
Alarm16.Click, Alarm17.Click, Alarm18.Click, Alarm19.Click,
Alarm20.Click, _
Alarm21.Click, Alarm22.Click, Alarm23.Click, Alarm24.Click,
Alarm25.Click, _
Alarm26.Click, Alarm27.Click, Alarm28.Click, Alarm29.Click,
Alarm30.Click, _
Alarm31.Click, Alarm32.Click, Alarm33.Click, Alarm34.Click,
Alarm35.Click, _
Alarm36.Click, Alarm37.Click, Alarm38.Click, Alarm39.Click,
Alarm30.Click, _
Alarm41.Click, Alarm42.Click

If bIgnoreClicks Then Exit Sub

If sender.Equals(Alarm1) Then : CheckAlarmVsWarn(Warn1, Alarm1) :
Exit Sub
ElseIf sender.Equals(Alarm2) Then : CheckAlarmVsWarn(Warn2, Alarm2)
: Exit Sub
ElseIf sender.Equals(Alarm3) Then : CheckAlarmVsWarn(Warn3, Alarm3)
: Exit Sub
ElseIf sender.Equals(Alarm4) Then : CheckAlarmVsWarn(Warn4, Alarm4)
: Exit Sub
ElseIf sender.Equals(Alarm5) Then : CheckAlarmVsWarn(Warn5, Alarm5)
: Exit Sub
ElseIf sender.Equals(Alarm6) Then : CheckAlarmVsWarn(Warn6, Alarm6)
: Exit Sub
ElseIf sender.Equals(Alarm7) Then : CheckAlarmVsWarn(Warn7, Alarm7)
: Exit Sub
ElseIf sender.Equals(Alarm8) Then : CheckAlarmVsWarn(Warn8, Alarm8)
: Exit Sub
ElseIf sender.Equals(Alarm9) Then : CheckAlarmVsWarn(Warn9, Alarm9)
: Exit Sub
ElseIf sender.Equals(Alarm10) Then : CheckAlarmVsWarn(Warn10,
Alarm10) : Exit Sub
ElseIf sender.Equals(Alarm11) Then : CheckAlarmVsWarn(Warn11,
Alarm11) : Exit Sub
ElseIf sender.Equals(Alarm12) Then : CheckAlarmVsWarn(Warn12,
Alarm12) : Exit Sub
ElseIf sender.Equals(Alarm13) Then : CheckAlarmVsWarn(Warn13,
Alarm13) : Exit Sub
ElseIf sender.Equals(Alarm14) Then : CheckAlarmVsWarn(Warn14,
Alarm14) : Exit Sub
ElseIf sender.Equals(Alarm15) Then : CheckAlarmVsWarn(Warn15,
Alarm15) : Exit Sub
ElseIf sender.Equals(Alarm16) Then : CheckAlarmVsWarn(Warn16,
Alarm16) : Exit Sub
ElseIf sender.Equals(Alarm17) Then : CheckAlarmVsWarn(Warn17,
Alarm17) : Exit Sub
ElseIf sender.Equals(Alarm18) Then : CheckAlarmVsWarn(Warn18,
Alarm18) : Exit Sub
ElseIf sender.Equals(Alarm19) Then : CheckAlarmVsWarn(Warn19,
Alarm19) : Exit Sub
ElseIf sender.Equals(Alarm20) Then : CheckAlarmVsWarn(Warn20,
Alarm20) : Exit Sub
ElseIf sender.Equals(Alarm21) Then : CheckAlarmVsWarn(Warn21,
Alarm21) : Exit Sub
ElseIf sender.Equals(Alarm22) Then : CheckAlarmVsWarn(Warn22,
Alarm22) : Exit Sub
ElseIf sender.Equals(Alarm23) Then : CheckAlarmVsWarn(Warn23,
Alarm23) : Exit Sub
ElseIf sender.Equals(Alarm24) Then : CheckAlarmVsWarn(Warn24,
Alarm24) : Exit Sub
ElseIf sender.Equals(Alarm25) Then : CheckAlarmVsWarn(Warn25,
Alarm25) : Exit Sub
ElseIf sender.Equals(Alarm26) Then : CheckAlarmVsWarn(Warn26,
Alarm26) : Exit Sub
ElseIf sender.Equals(Alarm27) Then : CheckAlarmVsWarn(Warn27,
Alarm27) : Exit Sub
ElseIf sender.Equals(Alarm28) Then : CheckAlarmVsWarn(Warn28,
Alarm28) : Exit Sub
ElseIf sender.Equals(Alarm29) Then : CheckAlarmVsWarn(Warn29,
Alarm29) : Exit Sub
ElseIf sender.Equals(Alarm30) Then : CheckAlarmVsWarn(Warn30,
Alarm30) : Exit Sub
ElseIf sender.Equals(Alarm31) Then : CheckAlarmVsWarn(Warn31,
Alarm31) : Exit Sub
ElseIf sender.Equals(Alarm32) Then : CheckAlarmVsWarn(Warn32,
Alarm32) : Exit Sub
ElseIf sender.Equals(Alarm33) Then : CheckAlarmVsWarn(Warn33,
Alarm33) : Exit Sub
ElseIf sender.Equals(Alarm34) Then : CheckAlarmVsWarn(Warn34,
Alarm34) : Exit Sub
ElseIf sender.Equals(Alarm35) Then : CheckAlarmVsWarn(Warn35,
Alarm35) : Exit Sub
ElseIf sender.Equals(Alarm36) Then : CheckAlarmVsWarn(Warn36,
Alarm36) : Exit Sub
ElseIf sender.Equals(Alarm37) Then : CheckAlarmVsWarn(Warn37,
Alarm37) : Exit Sub
ElseIf sender.Equals(Alarm38) Then : CheckAlarmVsWarn(Warn38,
Alarm38) : Exit Sub
ElseIf sender.Equals(Alarm39) Then : CheckAlarmVsWarn(Warn39,
Alarm39) : Exit Sub
ElseIf sender.Equals(Alarm40) Then : CheckAlarmVsWarn(Warn40,
Alarm40) : Exit Sub
ElseIf sender.Equals(Alarm41) Then : CheckAlarmVsWarn(Warn41,
Alarm41) : Exit Sub
ElseIf sender.Equals(Alarm42) Then : CheckAlarmVsWarn(Warn42,
Alarm42) : Exit Sub
End If

End SubOn Thu, 10 Jul 2008 17:15:22 -0500, in
microsoft.public.dotnet.languages.vb Tom Shelton
<to*********@comcastXXXXXXX.netwrote:
>>On 2008-07-10, John <no***************@nothing.comwrote:
>>glad to know its not just me, i would not even have considered using vb8
but
i do like the new updated appearance and i was worried that eventually
vb6
would not work with microsofts operating system updates.

practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly
the
whole day trying to achieve something that cannot be done simply (the
best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build
them
at run time and spend hours trying to get the layout correct, -
printing -
you cannot easily specify a new page without going into a recursive
print
handler which takes more time trying to handle your printing, etc etc
all
simple stuff but a nightmare in this product.

LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH
easier
then VB6. I know, I spent years doing VB work. I'm not claiming every
thing
is easier, just most.

Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for
control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...

' you can do this in the ide - just select all of the controls you want,
go
' to the event tab in the properties window and add the handler - the ide
will
' automatically add the handles list :)
Private Sub Button_Click (ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click

Dim clickedButton As Button = DirectCast (sender, Button)
' do button stuff
End Sub

There are times that using index's to access a control are helpful... And
even that is a fairly simple task.

Public Class MyForm
Inherits System.Windows.Forms.Form

Private buttons() As Button = new Button() {Button1, Button2, Button3}

...

Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
' do cool stuff with the button
End Sub
End Class

Or you can index them from the containser controls collection at runtime
by
the name:

Dim theButton As Button = DirectCast(Me.Controls("theButton"), Button)

There is no need to dynamically generate controls... You just have to
understand the differences and the capabilites of VB.NET and then you
don't
have these types of issues (well, at least not as often).

As for your file issue, I only was half joking about your file access -
the
fact is that .NET is a different target platform then VB6. VB6 targeted
COM
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways
is
not compatable. Personally, if I were you I would create a VB6 component
that
would be able to convert the files into a more .NET friendly format and
then
access them using the System.IO namespace classes. The FileXXX VB.NET
native
functions are crap...
Jul 19 '08 #43
In VB9 there are multiple ways to skin each cat. That's part of the
problem. Code bloat, more things to learn for no gain in function, more
things to break since there are multiple routines to run the multiple
ways one can do every function.

I will try your code. Thanks! Would be nice if it works. The controls
are updownnumeric controls. Both the Alarm and the Warn are
updownnumeric's. I hope this works with that kind of critter.

Surely wish they had SelectStart and SelectLength. They are bound to be
text boxes with an attached scroll bar type dongle added but then the
text handling is so weak that it might be something brand new with
insufficient code in it. I like to highlight the text when a control is
entered. Found I could not this time. It lowers the utility of the
control for me and my users.

Mike

On Sat, 19 Jul 2008 23:02:34 +1200, in
microsoft.public.dotnet.languages.vb "Stephany Young" <noone@localhost>
wrote:
>You must realise that there is more than one way of skinning a cat.
Jul 19 '08 #44

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vladimir Khvostov | last post by:
Hi, We have some DB2 table on the host that has varchar(3200) columns that are used to store binary data (I know that "varchar(3200) for bit data" should have been used, by modifying host table is...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
11
by: Steve Gough | last post by:
Could anyone please help me to understand what is happening here? The commented line produces an error, which is what I expected given that there is no conversion defined from type double to type...
3
by: Steve Richter | last post by:
here is a warning I am getting in a C++ .NET compile: c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while...
0
by: VB Programmer | last post by:
Simple ASP.NET 1 site. Opened solution in beta 2 of 2.0. Ran thru conversion wizard and it states: "Conversion Complete. There were some errors during conversion." I view the conversion log...
4
by: Påhl Melin | last post by:
I have some problems using conversion operators in C++/CLI. In my project I have two ref class:es Signal and SignalMask and I have an conversion function in Signal to convert Signal:s to...
14
by: Richard G. Riley | last post by:
Would it be wrong to use "implicit casting" instead of the standards "implicit conversion" when talking about implicit conversions between certain data types. The standard mentions "explicit...
6
by: Dhirendra Singh | last post by:
Hi, The following C++ program is not compiling on my system. #include <iostream> using namespace std; class complex { double re, im; public: complex( ) :re(0), im(0) {}
4
by: Coleen | last post by:
Hi All :-) I'm new to this site. I've been trying to convert several .Net 2003 web applications and getting tons of conversion errors. I found this site to help walk me through the...
8
by: Nikola | last post by:
Hello, I'm writing a String class for C++ and I'm getting the following error message when using operator: test.cpp: In function ‘int main()’: test.cpp:7: error: ISO C++ says that these are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.