473,388 Members | 1,417 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,388 software developers and data experts.

They do this in C# can't we do it in VB??

They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 1026, 1027, 1028}
End Structure 'DevicePropMap
Jan 15 '06 #1
22 1021

" **Developer**" <RE*************@a-znet.com> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl...
They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 1026, 1027, 1028}

End Structure 'DevicePropMap


Store 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028 as a
string and parse/tokenize it?
Jan 16 '06 #2
" **Developer**" <RE*************@a-znet.com> schrieb:
They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 1026, 1027, 1028}
End Structure 'DevicePropMap


Mhm... The code semantically doesn't make sense.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #3
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
" **Developer**" <RE*************@a-znet.com> schrieb:
They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 1026, 1027, 1028}
End Structure 'DevicePropMap


Mhm... The code semantically doesn't make sense.

It works with classes, why not with structures? It's just a member of the
type.
Armin

Jan 16 '06 #4
Hi,

Use a class instead of a structure

Public Class DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 1026, 1027, 1028}
End Class 'DevicePropMap
Ken
--------------
" **Developer**" <RE*************@a-znet.com> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl...
They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 1026, 1027, 1028}
End Structure 'DevicePropMap

Jan 16 '06 #5
Which version ? AFAIK it should work in 2.0...

--
Patrice

" **Developer**" <RE*************@a-znet.com> a écrit dans le message de
news:OV**************@TK2MSFTNGP15.phx.gbl...
They do this in C# can't we do it in VB??

Public Structure DevicePropMap

Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028}
End Structure 'DevicePropMap

Jan 16 '06 #6
"Patrice" <no****@nowhere.com> schrieb:
Which version ? AFAIK it should work in 2.0...


No, it doesn't work.

BTW: I would fire a programmer who designs a structure without instance
members...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #7
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
"Patrice" <no****@nowhere.com> schrieb:
Which version ? AFAIK it should work in 2.0...


No, it doesn't work.

BTW: I would fire a programmer who designs a structure without
instance members...

:-) I guess, ***Developer*** posted only the interesting part of the
structure.
Armin

Jan 16 '06 #8
This is the result of converting a C# program using the converter that I got
from MS.

Actually the structure did have another part but it was basically the same
except that the type was string.

I'm beyond worrying about getting fired, but just in case, what the problem
that Herfried sees?

Thanks for the replies. I'll try using Class as that was the only suggestion
as how to make it work. Wish me luck.

Thanks
"Armin Zingler" <az*******@freenet.de> wrote in message
news:ei**************@TK2MSFTNGP12.phx.gbl...
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
"Patrice" <no****@nowhere.com> schrieb:
> Which version ? AFAIK it should work in 2.0...


No, it doesn't work.

BTW: I would fire a programmer who designs a structure without
instance members...

:-) I guess, ***Developer*** posted only the interesting part of the
structure.
Armin

Jan 16 '06 #9
" **Developer**" <RE*************@a-znet.com> schrieb
I'm beyond worrying about getting fired, but just in case, what the
problem that Herfried sees?

A structure (object) is a container for data. If there's no data, there's
no need for a structure. I only guess that this is the problem Herfried
sees - and I would agree. In opposite to classes, the singleton pattern
doesn't make sense with structures, in other words, if you don't intend to
create an instance, a class is the better (and only) way to implement it.

Or, in other words, a structure is a value type. A value type without a
value does not make sense.
Armin

Jan 16 '06 #10
Armin,

Or, in other words, a structure is a value type. A value type without a
value does not make sense.

As I was almost writing as well. However than it did look me to silly to
write, as you I assumed that it was partial code.

Cor
Jan 16 '06 #11
Armin,

Did you know that this way of coding is the way were Cobol is very much
based on. Therefore it is maybe not impossible that some developpers still
use (mimic) it. (Giving the same memory area different names and different
structures).

Cor
Jan 16 '06 #12
Is the objection because there is only on variable.

Actually there were two variables.

One Integer array and one String array.

I think the struct mapped an id (integer) into a name (string).

The string array had the same format as the integer so I tried to simplify
the post.

Is the objection because there is only on variable and is that what you
meant by "singleton pattern"?
thanks
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb
I'm beyond worrying about getting fired, but just in case, what the
problem that Herfried sees?

A structure (object) is a container for data. If there's no data, there's
no need for a structure.


Seems to me there is data - the array of integers. On the other hand putting
the array into a structure does not seem to add anything unless there are
other variables in the structure and you want to indentify them as being
related.

I think I'm missing something here.
I only guess that this is the problem Herfried
sees - and I would agree. In opposite to classes, the singleton pattern
doesn't make sense with structures, in other words, if you don't intend to
create an instance, a class is the better (and only) way to implement it.

Or, in other words, a structure is a value type. A value type without a
value does not make sense.
Armin

Jan 16 '06 #13
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb
Armin,

Or, in other words, a structure is a value type. A value type
without a value does not make sense.

As I was almost writing as well. However than it did look me to
silly to write, as you I assumed that it was partial code.


Pardon?
Armin
Jan 16 '06 #14
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb
Armin,

Did you know that this way of coding is the way were Cobol is very
much based on.
No, I don't know Cobo.
Therefore it is maybe not impossible that some
developpers still use (mimic) it. (Giving the same memory area
different names and different structures).


Sorry Cor, I don't see the relation to the topic.
ARmin
Jan 16 '06 #15
" **Developer**" <RE*************@a-znet.com> schrieb
Is the objection because there is only on variable.

Actually there were two variables.

One Integer array and one String array.

I think the struct mapped an id (integer) into a name (string).

The string array had the same format as the integer so I tried to
simplify the post.

Is the objection because there is only on variable and is that what
you meant by "singleton pattern"?

The point is that there was /no/ /instance/ variable. But, ask Herfried, it
was his statement.
Armin

Jan 16 '06 #16
"Armin Zingler" <az*******@freenet.de> schrieb:
I'm beyond worrying about getting fired, but just in case, what the
problem that Herfried sees?


A structure (object) is a container for data. If there's no data, there's
no need for a structure. I only guess that this is the problem Herfried
sees - and I would agree. In opposite to classes, the singleton pattern
doesn't make sense with structures, in other words, if you don't intend to
create an instance, a class is the better (and only) way to implement it.


Full ACK.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #17
" **Developer**" <RE*************@a-znet.com> schrieb:
Is the objection because there is only on variable.

Actually there were two variables.
Two shared variables!
One Integer array and one String array.

I think the struct mapped an id (integer) into a name (string).

The string array had the same format as the integer so I tried to simplify
the post.

Is the objection because there is only on variable


The problem I see is that the variable is not an instance variable.
Instead, it's a shared variable. So it's irrelevant if you declare the
variable in a structure or a class. I suggest to post the complete code
listing and describe in more detail what you want to archieve. You may want
to include the full C# snippet too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #18
"Armin Zingler" <az*******@freenet.de> schrieb:
> They do this in C# can't we do it in VB??
>
> Public Structure DevicePropMap
>
> Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
> 12, 13, 14, 15, 1026, 1027, 1028}
>
>
> End Structure 'DevicePropMap


Mhm... The code semantically doesn't make sense.


It works with classes, why not with structures? It's just a member of the
type.


Could you describe a scenario where the code above would semantically make
sense?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #19
ACK hmmmmm ACK = 0x06 ;-)

regards

Michel

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u1*************@TK2MSFTNGP10.phx.gbl...
"Armin Zingler" <az*******@freenet.de> schrieb:
I'm beyond worrying about getting fired, but just in case, what the
problem that Herfried sees?


A structure (object) is a container for data. If there's no data, there's
no need for a structure. I only guess that this is the problem Herfried
sees - and I would agree. In opposite to classes, the singleton pattern
doesn't make sense with structures, in other words, if you don't intend
to
create an instance, a class is the better (and only) way to implement it.


Full ACK.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 16 '06 #20
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
"Armin Zingler" <az*******@freenet.de> schrieb:
> They do this in C# can't we do it in VB??
>
> Public Structure DevicePropMap
>
> Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10,
> 11, 12, 13, 14, 15, 1026, 1027, 1028}
>
>
> End Structure 'DevicePropMap

Mhm... The code semantically doesn't make sense.


It works with classes, why not with structures? It's just a member
of the type.


Could you describe a scenario where the code above would
semantically make sense?

This is not the answer to my question. ;-) At the same places where it makes
sense with classes.
Armin

Jan 16 '06 #21

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...
> > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10,
> > > 11, 12, 13, 14, 15, 1026, 1027, 1028}
This is not the answer to my question. ;-) At the same places where it
makes sense with classes.


In the dark days, you could do this

10 DIM I(17)
20 FOR I = 1 TO 17
30 READ I(I)
40 NEXT I
10000 DATA 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028

.... but not these days!
Jan 16 '06 #22
"Homer J Simpson" <no****@nowhere.com> schrieb
In the dark days, you could do this

10 DIM I(17)
20 FOR I = 1 TO 17
30 READ I(I)
40 NEXT I
10000 DATA 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026,
1027, 1028

... but not these days!

Still possible on my CPC emulator. ;-)
Armin
Jan 16 '06 #23

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

Similar topics

7
by: Jayne Wolps | last post by:
Hello I wonder if anyone can help. I would like to know how certain sites: http://aboutbritain.com/ArundelCastle.htm, and http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx...
0
by: rcs | last post by:
Looks like you've come to a real Z00 here! Yeap! We have goats, we have horses, sheep, snakes, even dogs! e have lots of @n1m@ls here and we also have lots of g1r|s who just love to have some s....
0
by: jirap | last post by:
Looks like you've come to a real Z00 here! Yeap! We have goats, we have horses, sheep, snakes, even dogs! e have lots of @n1m@ls here and we also have lots of g1r|s who just love to have some s....
4
by: Nicolas Verhaeghe | last post by:
I have designed an application which uses the Crystal Reports 8.5 ActiveX to show a report as a PDF. The report is compiled from a SQL database populated through web forms programmed in ASP. ...
40
by: komone | last post by:
"Now is the time for all good web developers to use stylesheets". Hmm OK, so I start this commercial site design with the express intent of using CSS entirely. (Something I haven't attempted in...
4
by: Fred | last post by:
I'm a newbie to JavaScript so be gentle. You know that funky IE margin issue that causes the right side of the page to get cut off when the user prints the html document?...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.