Here is my code, but get errors:
Dim installment = 1
Dim beginDate = "1/1/03"
Dim endDate = "1/1/08"
Dim dates(5) As Array
While installment <= 5
endDate = DateAdd(DateInterval.Year, 1, beginDate)
dates.SetValue(couponEndDate, installment)
installment = installment + 1
beginDate = endDate
End While
I even tried to conver the date value to a string, but still recieved
"Object cannot be stored in an array of this type."
TIA,
Steve Wofford www.IntraRELY.com 10 7117
Hi Steve,
First question, what vb.net version are you using.
My first thougth was that it was without Vs.net what it seems, but seeing
the link you supported you probably are normal using Visual Studio.
Dim installment = 1 is not good code that would probably be
Dim installment as integer = 1
Dim beginDate = "1/1/03" can be
Dim beginDate as string = "1/1/03" but you probably want to do it as a date.
There is not one error in the code but probably 10.
My advice, start with to put in the top of your program
option explicit on
option strict on
Than you sees a lot of this errors direct.
I hope this helps a little bit?
Cor Here is my code, but get errors:
Dim installment = 1 Dim beginDate = "1/1/03" Dim endDate = "1/1/08" Dim dates(5) As Array While installment <= 5 endDate = DateAdd(DateInterval.Year, 1, beginDate) dates.SetValue(couponEndDate, installment) installment = installment + 1 beginDate = endDate End While
I even tried to conver the date value to a string, but still recieved "Object cannot be stored in an array of this type."
TIA,
Steve Wofford www.IntraRELY.com
some things to try
ill modify your code a bit Dim installment = 1 Dim beginDate as new datetime(cdate("1/1/03")) Dim endDate as new datetime(cdate("1/1/08")) Dim dates(5) As datetime
not sure w you are trying to do here While installment <= 5 endDate = DateAdd(DateInterval.Year, 1, beginDate) dates.SetValue(couponEndDate, installment) installment = installment + 1 beginDate = endDate End While
try this
for i as integer = 1 to 5
dates(i) = dateadd((DateInterval.Year, i, beginDate)
next
I even tried to conver the date value to a string, but still recieved "Object cannot be stored in an array of this type."
TIA,
Steve Wofford www.IntraRELY.com
* "IntraRELY" <In*******@yahoo.com> scripsit: Here is my code, but get errors:
Dim installment = 1 Dim beginDate = "1/1/03" Dim endDate = "1/1/08"
Declare the variables above in a specific type, 'installment' as
'Integer', the other variables as 'Date'. Use "#1/1/08#" instead of
""1/1/08"".
Dim dates(5) As Array
Why not 'As Date'?
While installment <= 5 endDate = DateAdd(DateInterval.Year, 1, beginDate) dates.SetValue(couponEndDate, installment) installment = installment + 1 beginDate = endDate End While
I even tried to conver the date value to a string, but still recieved "Object cannot be stored in an array of this type."
Are you sure you know what you want to do?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
"Cor" <no*@non.com> schrieb My advice, start with to put in the top of your program option explicit on option strict on
I agree (I do this to convince Steve that it is really the way to go) ;-)
--
Armin
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb * "IntraRELY" <In*******@yahoo.com> scripsit: Here is my code, but get errors:
Dim installment = 1 Dim beginDate = "1/1/03" Dim endDate = "1/1/08" Declare the variables above in a specific type, 'installment' as 'Integer', the other variables as 'Date'. Use "#1/1/08#" instead of ""1/1/08"".
I know why you have two (or four) """"" *g* but I'd like to add an example
(just to clarify):
dim begindate as date = #1/1/03#
....and I'd like to add - to Mr. IntraRELY - that this is a date literal and
described in chapter 2.4.6 of the VB language specifications.
Are you sure you know what you want to do?
Not so sarcastic, HKW! ;-))
--
Armin
Hi Armin, Are you sure you know what you want to do?
Not so sarcastic, HKW! ;-))
I dont think this is sarcasme, I think in this case it is a good question,
and while writing this, maybe it would have be better
Can you explain us what you want to do?
But as I started, in this case I think it is not wrong.
Just a thought
Cor
"Cor" <no*@non.com> schrieb Hi Armin,
Are you sure you know what you want to do?
Not so sarcastic, HKW! ;-))
I dont think this is sarcasme, I think in this case it is a good question, and while writing this, maybe it would have be better
Can you explain us what you want to do?
But as I started, in this case I think it is not wrong.
Just a thought
Cor
Ah c'mon ... missed the smiley? If I had written such a sentence few weeks
ago, I probably would have been stoned to death by some hypersensitive
people. :)
--
Armin
Hi Armin,
I did not mis it, but did write it with the same reason as you did this
morning with my post about option strict, :-))
(not for you)
I hope you understand this.
Cor
* "Armin Zingler" <az*******@freenet.de> scripsit: I dont think this is sarcasme, I think in this case it is a good question, and while writing this, maybe it would have be better
Can you explain us what you want to do?
But as I started, in this case I think it is not wrong.
Just a thought
Ah c'mon ... missed the smiley? If I had written such a sentence few weeks ago, I probably would have been stoned to death by some hypersensitive people. :)
I apologize for being so rude. Shame on me.
;-)
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
* "Armin Zingler" <az*******@freenet.de> scripsit: Here is my code, but get errors:
Dim installment = 1 Dim beginDate = "1/1/03" Dim endDate = "1/1/08" Declare the variables above in a specific type, 'installment' as 'Integer', the other variables as 'Date'. Use "#1/1/08#" instead of ""1/1/08"".
I know why you have two (or four) """"" *g* but I'd like to add an example (just to clarify):
LOL... I use """ as a markup for strings or characters, that's why I
typed two """ characters.
dim begindate as date = #1/1/03#
...and I'd like to add - to Mr. IntraRELY - that this is a date literal and described in chapter 2.4.6 of the VB language specifications.
Are you sure you know what you want to do?
Not so sarcastic, HKW! ;-))
;-))
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hale |
last post by:
Hi,
I'm having a problem storing an array inside of a hash. I'm bringing
in a hash via a reference and I want to assign a value to it. This is what
I'm doing:
push (@{$$node->{ELEMENTS}},...
|
by: Mark Hannon |
last post by:
I am trying to wrap my brain around storing form elements inside
variables & arrays before I move on to a more complicated project. I
created this simple example to experiment and as far as I can...
|
by: mike |
last post by:
If I had a date in the format "01-Jan-05" it does not sort properly
with my sort routine:
function compareDate(a,b)
{
var date_a = new Date(a);
var date_b = new Date(b);
if (date_a < date_b)...
|
by: Trond |
last post by:
I have been trying to fig out how to build up an array with dates. When its
generated i want to be able to remove duplicate dates. The dates is
generated by FileInfo object that is scanning a...
|
by: (PeteCresswell) |
last post by:
User wants to go this route instead of storing pointers in the DB and the
documents outside.
Only time I tried it was with only MS Word docs - and that was a loooong time
ago - and it seemed to...
|
by: Smokey Grindle |
last post by:
Ok I must admit I stink at regular expressions... been trying to learn them
for a while now and its not sticking how I wish it would... but I am trying
to take a very long string (about 30KB) and...
|
by: fauxanadu |
last post by:
Is it possible to store dates before 01/01/0100 A.D. (such as for as database storing world events would require) using MS Access?
Verbose Explination
I need to be able to store dates before...
|
by: Stubert |
last post by:
I have a training module db that stores information about employees
and what training they have carried our or need to carry out. One
table in this database stores what training needs to be carried...
|
by: John A Grandy |
last post by:
What are some best practices for storing pure dates and pure times in .NET ?
I notice that DateTime.TimeOfDay() returns type TimeSpan , which is
certainly sufficient for storing pure times , but...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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: 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: 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...
| |