I need an array with two columns, values in column 1 are datetime and in
column 2 they are numeric with up to two decimal places.
What's the Dim statement to create this?
Any help is greatly appreciated.
Bob 13 1079
If you want to have the 2 data types preserved use an ArrayList object or a
Collection object, rather than a simple single-type array.
"Robert Dufour" <bd*****@sgiims.comwrote in message
news:ev**************@TK2MSFTNGP05.phx.gbl...
>I need an array with two columns, values in column 1 are datetime and in column 2 they are numeric with up to two decimal places.
What's the Dim statement to create this?
Any help is greatly appreciated.
Bob
"Robert Dufour" <bd*****@sgiims.comschrieb
I need an array with two columns, values in column 1 are datetime
and in column 2 they are numeric with up to two decimal places.
What's the Dim statement to create this?
Any help is greatly appreciated.
structure Item
public v1 as date
public v2 as decimal
end structure
'...
dim items(17) as item
items(0).v1 = date.now
items(0).v2 = 17.34
with items(1)
.v1 = date.now
.v2 = 17.34
end with
Armin
Thanks
Bob
"Armin Zingler" <az*******@freenet.dewrote in message
news:uG**************@TK2MSFTNGP04.phx.gbl...
"Robert Dufour" <bd*****@sgiims.comschrieb
>I need an array with two columns, values in column 1 are datetime and in column 2 they are numeric with up to two decimal places.
What's the Dim statement to create this?
Any help is greatly appreciated.
structure Item
public v1 as date
public v2 as decimal
end structure
'...
dim items(17) as item
items(0).v1 = date.now
items(0).v2 = 17.34
with items(1)
.v1 = date.now
.v2 = 17.34
end with
Armin
Armin,
Is a List Of(item) not nicer?
Cor
"Armin Zingler" <az*******@freenet.deschreef in bericht
news:uG**************@TK2MSFTNGP04.phx.gbl...
"Robert Dufour" <bd*****@sgiims.comschrieb
>I need an array with two columns, values in column 1 are datetime and in column 2 they are numeric with up to two decimal places.
What's the Dim statement to create this?
Any help is greatly appreciated.
structure Item
public v1 as date
public v2 as decimal
end structure
'...
dim items(17) as item
items(0).v1 = date.now
items(0).v2 = 17.34
with items(1)
.v1 = date.now
.v2 = 17.34
end with
Armin
Hi Cor,
well, he asked for an array, I gave him an array. ;-)
You're right with VB 2005, but as Item is a structure (it doesn't have to
be), it's more complicated if you use it with the generic List. You can not
simply write
items(0).v1 = ...
items(0).v2 = ...
you would have to write
dim i as item
i.v1=..
i.v2=..
items(0) = i
Armin
"Cor Ligthert [MVP]" <no************@planet.nlschrieb
Armin,
Is a List Of(item) not nicer?
Cor
"Armin Zingler" <az*******@freenet.deschreef in bericht
news:uG**************@TK2MSFTNGP04.phx.gbl...
"Robert Dufour" <bd*****@sgiims.comschrieb
I need an array with two columns, values in column 1 are
datetime and in column 2 they are numeric with up to two decimal
places.
>
What's the Dim statement to create this?
>
Any help is greatly appreciated.
structure Item
public v1 as date
public v2 as decimal
end structure
'...
dim items(17) as item
items(0).v1 = date.now
items(0).v2 = 17.34
with items(1)
.v1 = date.now
.v2 = 17.34
end with
Armin
"Robert Dufour" <bd*****@sgiims.comwrote in message
news:ev**************@TK2MSFTNGP05.phx.gbl...
:
: I need an array with two columns, values in column 1 are datetime
: and in column 2 they are numeric with up to two decimal places.
:
: What's the Dim statement to create this?
:
: Any help is greatly appreciated.
:
: Bob
Just for the sake of a little diversity...
===========================================
Option Strict On
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Public Module [module]
public sub main
Dim dictionary As New Dictionary(Of DateTime, Decimal)
With dictionary
.Add(Date.Now, 12.34D)
.Add(#1/2/2007#, 5678910.11D)
End With
Dim kvp As KeyValuePair(Of Date, Decimal)
For Each kvp In dictionary
Console.WriteLine("Key={0}, Value={1}", _
kvp.Key, kvp.Value)
Next
End sub
End Module
===========================================
Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
----------------------------------------------------------
There are no advanced students in Aikido - there are only
competent beginners. There are no advanced techniques -
only the correct application of basic principles.
"Armin Zingler" <az*******@freenet.dewrote in message
news:ud*************@TK2MSFTNGP06.phx.gbl...
Hi Cor,
well, he asked for an array, I gave him an array. ;-)
You're right with VB 2005, but as Item is a structure (it doesn't have to
be), it's more complicated if you use it with the generic List. You can
not
simply write
items(0).v1 = ...
items(0).v2 = ...
you would have to write
dim i as item
i.v1=..
i.v2=..
items(0) = i
Armin
"Cor Ligthert [MVP]" <no************@planet.nlschrieb
>Armin,
Is a List Of(item) not nicer?
Cor
"Armin Zingler" <az*******@freenet.deschreef in bericht news:uG**************@TK2MSFTNGP04.phx.gbl...
"Robert Dufour" <bd*****@sgiims.comschrieb
I need an array with two columns, values in column 1 are
datetime and in column 2 they are numeric with up to two decimal
places.
What's the Dim statement to create this?
Any help is greatly appreciated.
structure Item
public v1 as date
public v2 as decimal
end structure
'...
dim items(17) as item
items(0).v1 = date.now
items(0).v2 = 17.34
with items(1)
.v1 = date.now
.v2 = 17.34
end with
Armin
In which case you can just add a constructor to the structure that took 2
parameters, the names of the properties to set. Then you could just use:
items(0) = New Item(someDate, someDecimal)
:)
HTH,
Mythran
"Mythran" <ki********@hotmail.comschrieb
You're right with VB 2005, but as Item is a structure (it doesn't
have to
be), it's more complicated if you use it with the generic List.
You can
not
simply write
items(0).v1 = ...
items(0).v2 = ...
you would have to write
dim i as item
i.v1=..
i.v2=..
items(0) = i
In which case you can just add a constructor to the structure that
took 2
parameters, the names of the properties to set. Then you could just
use:
items(0) = New Item(someDate, someDecimal)
:)
Right, but my example doesn't create a new item.
Armin
"Armin Zingler" <az*******@freenet.dewrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
"Mythran" <ki********@hotmail.comschrieb
You're right with VB 2005, but as Item is a structure (it doesn't
have to
be), it's more complicated if you use it with the generic List.
You can
not
simply write
items(0).v1 = ...
items(0).v2 = ...
you would have to write
dim i as item
i.v1=..
i.v2=..
items(0) = i In which case you can just add a constructor to the structure that took 2 parameters, the names of the properties to set. Then you could just use:
items(0) = New Item(someDate, someDecimal)
:)
Right, but my example doesn't create a new item.
Armin
Umm, yeah it did :0
Dim i As Item
is the same as
Dim i As Item = New Item()
where Item is a structure....
:)
Mythran
"Mythran" <ki********@hotmail.comschrieb
>
"Armin Zingler" <az*******@freenet.dewrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
"Mythran" <ki********@hotmail.comschrieb
You're right with VB 2005, but as Item is a structure (it
doesn't have to
be), it's more complicated if you use it with the generic
List. You can
not
simply write
items(0).v1 = ...
items(0).v2 = ...
you would have to write
dim i as item
i.v1=..
i.v2=..
items(0) = i
>
In which case you can just add a constructor to the structure
that took 2
parameters, the names of the properties to set. Then you could
just use:
>
items(0) = New Item(someDate, someDecimal)
>
:)
Right, but my example doesn't create a new item.
Armin
Umm, yeah it did :0
Dim i As Item
is the same as
Dim i As Item = New Item()
where Item is a structure....
:)
[After many revisions...]
Yes and no. :-)
My List has as many items as before, so I didn't create a new item.
I am referring to the logical level. I only wanted to show that you can not
simply write
items(0).field = ...
but you have to a) declare a variable b) set the field values c) put the
item in the list. That's why I call it more complicated. That the existence
of the additional declaration of variable i also means the implicit creation
of a new object can not be prevented, but the code's purpose is still
/changing/ an existing item. If I wanted to create a /new/ one I would have
to write Items.Add.
Talking about instances, we know that it is never possible to really change
the item in the List, and we neither get the same object back from the List
that we added, nor the object we add is stored in the list. It is always a
copy because it is a value type.
In other words, if somebody wants to know how to change an item in the List,
I would still answer
dim i as item
i.v1=..
i.v2=..
items(0) = i
On a logical level this is the required change whereas on a "physical" level
it's the creation of (at least) one new object. So, we both are right. :-)
Armin
Mythran,
You know Armin from the past. This will probably a long thread.
However mostly all threads Armin is involved in are very good to search for
later when they are ready.
Success,
:-)
Cor
"Mythran" <ki********@hotmail.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
"Armin Zingler" <az*******@freenet.dewrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
>"Mythran" <ki********@hotmail.comschrieb
>You're right with VB 2005, but as Item is a structure (it doesn't have to be), it's more complicated if you use it with the generic List. You can not simply write
items(0).v1 = ... items(0).v2 = ...
you would have to write
dim i as item
i.v1=.. i.v2=..
items(0) = i
In which case you can just add a constructor to the structure that took 2 parameters, the names of the properties to set. Then you could just use:
items(0) = New Item(someDate, someDecimal)
:)
Right, but my example doesn't create a new item.
Armin
Umm, yeah it did :0
Dim i As Item
is the same as
Dim i As Item = New Item()
where Item is a structure....
:)
Mythran
"Cor Ligthert [MVP]" <no************@planet.nlschrieb
Mythran,
You know Armin from the past. This will probably a long thread.
Heeey, I didn't know I'm mainly responsible for long threads. ;-) I'm only
(still) not able to say what I want to say briefly. ;-(
Armin
Armin,
After sending this, I got the idea that you would read it as you did. I
wanted to say that you mostly investigate very good what you are writing
(after a quick start).
:-)
Cor
"Armin Zingler" <az*******@freenet.deschreef in bericht
news:%2****************@TK2MSFTNGP06.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nlschrieb
>Mythran,
You know Armin from the past. This will probably a long thread.
Heeey, I didn't know I'm mainly responsible for long threads. ;-) I'm only
(still) not able to say what I want to say briefly. ;-(
Armin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Keiron Waites |
last post by:
<script language="JavaScript" type="text/javascript">
<!--
var array1 = new Array();
var array1i = new Array();
array1 = array1i;
alert(array1);
// -->
</script>
|
by: svend |
last post by:
I'm messing with some code here... Lets say I have this array:
a1 = ;
And I apply slice(0) on it, to create a copy:
a2 = a1.slice(0);
But this isn't a true copy. If I go a1 = 42, and then...
|
by: kaul |
last post by:
i want to create a 2-d array containg r rows and c columns by dynamic
memory allocation in a single statement so that i will be able to access
the ith and jth index as say arr
how is that...
|
by: Chris |
last post by:
Hi,
to create an array of 2 objects (e.g. of type '__gc class Airplane') I need
to do :
Airplane * arrAirplanes __gc = new Airplane* __gc;
arrAirplanes = new Airplane("N12344");
arrAirplanes...
|
by: jwgoerlich |
last post by:
Hello,
I need to create a 1 GB Byte array in memory. I can create it on a
Win2000 system. On a Win2003 system, the application throws a
System.OutOfMemoryException error. Both are running the...
|
by: djhulme |
last post by:
Hi,
I'm using GCC. Please could you tell me, what is the maximum number of
array elements that I can create in C, i.e.
char* anArray = (char*) calloc( ??MAX?? , sizeof(char) ) ;
I've...
|
by: ctiggerf |
last post by:
I was hopeing someone could help me out here. Been stumped on this
one all day.
This function
1. Checks uploaded files.
2. Creates two resized images from each (a full size, and a...
|
by: Justcallmedrago |
last post by:
How would you declare and assign a variable inside a function THAT HAS
THE NAME OF A PARAMETER YOU PASSED
example:
when you call createvariable("myvariable")
it will declare the variable...
|
by: Matthew Wells |
last post by:
Hello.
I have figured out how to create an instance of an object only knowing the
type by string.
string sName = "MyClassName";
Type t = Type.GetType(sName);
Object objNew =...
|
by: oswald.harry |
last post by:
hi
i am reading a set of jpeg files(RGB) and extracts the pixel values as
longs.i want to create a
2d array with numof rows=numof images and numof cols=numof pixels in
each image.ie each row of...
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |