Hello,
If I leave Option Strict Off I can use the following
syntax to read data from a Lotus Notes application (a
NotesViewEntry object represents a row of data from a
Lotus Notes View - like a record in a sql Server view)
....
Dim entry As Domino.NotesViewEntry
Dim obj As Object
str1 = entry.ColumnValues(0)
For Each obj In entry.ColumnValues
str1 = obj
....
But if I turn Option Strict on then I get a "Late Binding
not allowed" error for
str1 = entry.ColumnValues(0)
and "Expression is of type System Object which is not a
collection type" for
For Each obj In entry.ColumnValues
....
I also tried
Dim obj() As Object = entry.ColumValues
and got the error message that "Option Strict doesn't
allow implicit conversions from System.Object to a 1
dimensional array of System.Object"
But it did allow
Dim obj As Object = entry.ColumnValues
Could anyone suggest conversion syntax or how I could
extract data from obj with Option Strict on? As long as I
am using .Net, I am trying to get into the habit of using
it correctly.
TIA,
Rich 8 1795
"Rich" <an*******@discussions.microsoft.com> schrieb Hello,
If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) ... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0) For Each obj In entry.ColumnValues str1 = obj ...
But if I turn Option Strict on then I get a "Late Binding not allowed" error for
str1 = entry.ColumnValues(0)
I assume you declared str1 As String as in your last post?
Are you sure ColumnValues(0) always returns a string? If it does, use
str1 = entry.ColumnValues(0).ToString
and "Expression is of type System Object which is not a collection type" for
For Each obj In entry.ColumnValues ...
What is the type of the ColumnValues property? I guess it's Object. What
type is really returned at runtime? To find it out, assign it to a variable
declared as Object and have a look at the Debug/Locals window. Then change
your code and cast to that type:
For Each obj In directcast(entry.ColumnValues, <EnterTypeHere>)
What type of items are contained in ColumnValues? You can declare variable
'obj' as this type.
I also tried
Dim obj() As Object = entry.ColumValues
and got the error message that "Option Strict doesn't allow implicit conversions from System.Object to a 1 dimensional array of System.Object"
But it did allow Dim obj As Object = entry.ColumnValues
Could anyone suggest conversion syntax or how I could extract data from obj with Option Strict on? As long as I am using .Net, I am trying to get into the habit of using it correctly.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
str1 = Cstr(entry.ColumnValues(0) )
Thanks all for your replies, but I have tried variations
of your suggestions without success. With Option Strict
On I keep getting the message that "Late Binding not
allowed"
str = Cstr(entry.ColumnValues(0)) --- won't work with
Option Strict on - says entry or entry.ColumnValues is a
System.Object. If it works with Option Strict Off then I
am sure it will work with Option Strict On - just "what is
the correct syntax?" I would really like to reap the
benefit of early binding. Note: sometime a value from
entry.ColumnValues(i) could be an array (a variant) from
which in VB6 I had to say str1 = Itm(0)
(checked if IsArray(Itm) then str1 = Itm(0)). This also
works with Option Strict off. So the question is "what
does VB.Net think a NotesViewEntry object is?" for early
binding. It seems to figure out what a NotesViewEntry
object is with Late binding. Early binding calls it a
System.Object. How can I access the contents of this
object?
Thanks for your replies,
Rich -----Original Message----- Hello,
If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) .... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0) For Each obj In entry.ColumnValues str1 = obj ....
But if I turn Option Strict on then I get a "Late Binding not allowed" error for
str1 = entry.ColumnValues(0)
and "Expression is of type System Object which is not a collection type" for
For Each obj In entry.ColumnValues ....
I also tried
Dim obj() As Object = entry.ColumValues
and got the error message that "Option Strict doesn't allow implicit conversions from System.Object to a 1 dimensional array of System.Object"
But it did allow Dim obj As Object = entry.ColumnValues
Could anyone suggest conversion syntax or how I could extract data from obj with Option Strict on? As long as
Iam using .Net, I am trying to get into the habit of using it correctly.
TIA, Rich
.
try str = DirectCast(entry.ColumnValues(0), String)
or str = CType(entry.ColumnValues(0), String)
also, if you're saying that .net is recognizing entry.ColumnValues(0) as
a 'Object' type, you could do what Armin suggested..that should work..
hope this helps..
"Rich" wrote: Thanks all for your replies, but I have tried variations of your suggestions without success. With Option Strict On I keep getting the message that "Late Binding not allowed"
str = Cstr(entry.ColumnValues(0)) --- won't work with Option Strict on - says entry or entry.ColumnValues is a System.Object. If it works with Option Strict Off then I am sure it will work with Option Strict On - just "what is the correct syntax?" I would really like to reap the benefit of early binding. Note: sometime a value from entry.ColumnValues(i) could be an array (a variant) from which in VB6 I had to say str1 = Itm(0) (checked if IsArray(Itm) then str1 = Itm(0)). This also works with Option Strict off. So the question is "what does VB.Net think a NotesViewEntry object is?" for early binding. It seems to figure out what a NotesViewEntry object is with Late binding. Early binding calls it a System.Object. How can I access the contents of this object?
Thanks for your replies, Rich
-----Original Message----- Hello,
If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) .... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0) For Each obj In entry.ColumnValues str1 = obj ....
But if I turn Option Strict on then I get a "Late Binding not allowed" error for
str1 = entry.ColumnValues(0)
and "Expression is of type System Object which is not a collection type" for
For Each obj In entry.ColumnValues ....
I also tried
Dim obj() As Object = entry.ColumValues
and got the error message that "Option Strict doesn't allow implicit conversions from System.Object to a 1 dimensional array of System.Object"
But it did allow Dim obj As Object = entry.ColumnValues
Could anyone suggest conversion syntax or how I could extract data from obj with Option Strict on? As long as Iam using .Net, I am trying to get into the habit of using it correctly.
TIA, Rich
.
Thanks but already tried that to no avail. I think my
real question would be if the VB.Net compiler can perform
late binding on an object does that guarantee that early
binding can be performed - if the data type is known?
It turns out the the NotesViewEntry object is actually an
array of variant (or objects in .Net language) per the
help files in Lotus Notes Designer help. Tommorrow I will
try CType(entry.ColumnValues, ArrayList)
or something that is an array of objects. Right now, the
VB.Net compiler regards the NotesViewEntry object as a
system.Object type. But eventually it seems to figure out
what it is because with Option Strict Off my VB6 codes
runs in VB.Net. I just believe that I would see a
signifcant gain in performance if I could do this with
early binding.
So what kind of VB.Net object (datatype) is an array of
objects?
Thanks,
Rich -----Original Message----- try str = DirectCast(entry.ColumnValues(0), String) or str = CType(entry.ColumnValues(0), String)
also, if you're saying that .net is recognizing
entry.ColumnValues(0) asa 'Object' type, you could do what Armin suggested..that
should work.. hope this helps..
"Rich" wrote:
Thanks all for your replies, but I have tried
variations of your suggestions without success. With Option
Strict On I keep getting the message that "Late Binding not allowed"
str = Cstr(entry.ColumnValues(0)) --- won't work with Option Strict on - says entry or entry.ColumnValues is
a System.Object. If it works with Option Strict Off then
I am sure it will work with Option Strict On - just "what
is the correct syntax?" I would really like to reap the benefit of early binding. Note: sometime a value from entry.ColumnValues(i) could be an array (a variant)
from which in VB6 I had to say str1 = Itm(0) (checked if IsArray(Itm) then str1 = Itm(0)). This
also works with Option Strict off. So the question is "what does VB.Net think a NotesViewEntry object is?" for
early binding. It seems to figure out what a NotesViewEntry object is with Late binding. Early binding calls it a System.Object. How can I access the contents of this object?
Thanks for your replies, Rich
>-----Original Message----- >Hello, > >If I leave Option Strict Off I can use the following >syntax to read data from a Lotus Notes application (a >NotesViewEntry object represents a row of data from a >Lotus Notes View - like a record in a sql Server view) >.... >Dim entry As Domino.NotesViewEntry >Dim obj As Object >str1 = entry.ColumnValues(0) >For Each obj In entry.ColumnValues > str1 = obj >.... > >But if I turn Option Strict on then I get a "Late
Binding >not allowed" error for > >str1 = entry.ColumnValues(0) > >and "Expression is of type System Object which is not
a >collection type" for > >For Each obj In entry.ColumnValues >.... > >I also tried > >Dim obj() As Object = entry.ColumValues > >and got the error message that "Option Strict doesn't >allow implicit conversions from System.Object to a 1 >dimensional array of System.Object" > >But it did allow >Dim obj As Object = entry.ColumnValues > >Could anyone suggest conversion syntax or how I could >extract data from obj with Option Strict on? As long
as I >am using .Net, I am trying to get into the habit of
using >it correctly. > >TIA, >Rich > >. > .
I don't think you can use the OPTION STRICT ON in this case. I was
looking at the object model for the Domino OBJECT (spefically what the
ColumnValues returns). It returns a variant array.
If the OPTION STRICT requires explicit conversions, you have to test
the type of each ColumnValue(i) to figure out what it's type is and
convert it to the destination type.
Maybe? Then again, I may not know what I'm talking about since I've
only been programming in vb.net for 2.75 days now.
William
In article <1d*****************************@phx.gbl>, Rich
<an*******@discussions.microsoft.com> wrote: Hello,
If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) ... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0) For Each obj In entry.ColumnValues str1 = obj ...
But if I turn Option Strict on then I get a "Late Binding not allowed" error for
str1 = entry.ColumnValues(0)
and "Expression is of type System Object which is not a collection type" for
For Each obj In entry.ColumnValues ...
I also tried
Dim obj() As Object = entry.ColumValues
and got the error message that "Option Strict doesn't allow implicit conversions from System.Object to a 1 dimensional array of System.Object"
But it did allow Dim obj As Object = entry.ColumnValues
Could anyone suggest conversion syntax or how I could extract data from obj with Option Strict on? As long as I am using .Net, I am trying to get into the habit of using it correctly.
TIA, Rich
"Rich" <an*******@discussions.microsoft.com> schrieb Thanks but already tried that to no avail. I think my real question would be if the VB.Net compiler can perform late binding on an object does that guarantee that early binding can be performed - if the data type is known?
It turns out the the NotesViewEntry object is actually an array of variant (or objects in .Net language) per the help files in Lotus Notes Designer help. Tommorrow I will try CType(entry.ColumnValues, ArrayList) or something that is an array of objects. Right now, the VB.Net compiler regards the NotesViewEntry object as a system.Object type. But eventually it seems to figure out what it is because with Option Strict Off my VB6 codes runs in VB.Net. I just believe that I would see a signifcant gain in performance if I could do this with early binding.
So what kind of VB.Net object (datatype) is an array of objects?
Why not have a look at the object and it's type, returned from
entry.columnvalues (as already suggested)?
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Success! Thank you all for the inspiration
Dim arr As Array = Ctype(entry.ColumnValues, Array)
Console.WriteLine(arr.GetValue(0).ToString)
entry.ColumnValues is an Array! An Array of variants
(objects) -----Original Message----- "Rich" <an*******@discussions.microsoft.com> schrieb Thanks but already tried that to no avail. I think my real question would be if the VB.Net compiler can
perform late binding on an object does that guarantee that early binding can be performed - if the data type is known?
It turns out the the NotesViewEntry object is actually
an array of variant (or objects in .Net language) per the help files in Lotus Notes Designer help. Tommorrow I
will try CType(entry.ColumnValues, ArrayList) or something that is an array of objects. Right now,
the VB.Net compiler regards the NotesViewEntry object as a system.Object type. But eventually it seems to figure
out what it is because with Option Strict Off my VB6 codes runs in VB.Net. I just believe that I would see a signifcant gain in performance if I could do this with early binding.
So what kind of VB.Net object (datatype) is an array of objects?
Why not have a look at the object and it's type, returned
fromentry.columnvalues (as already suggested)?
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: fabrice |
last post by:
Hello
I have a little problem with casting in a Datagrid Control. I'm using Option
Strict in my web application.
In a Template Column, I put in an ImageButton Control with a Command...
|
by: Daylor |
last post by:
hi.
im using option strict on.
im doing in ,from the simple reason ,to be warn when there are implict
conversion like string to int ,int to string.
BUT.
the price ,(now i see ), is very bad....
|
by: Eduardo Garcia-Prieto |
last post by:
I have come accross a problem in using the
Interlocked.Exchange(Object, Object) method while using Option Strict
On in my project. I have a private class structure variable which can
be updated...
|
by: Clark Stevens |
last post by:
I've always used Option Strict in my code. However, I was wondering if it
is really necessary. Coding seems a lot easier when you don't use it, but
does it really make a difference? What are the...
|
by: Howard Kaikow |
last post by:
I am trying to retrive some WMI properties using Option Strict On.
This requires the use of InvokeMember.
I know that there are alternative ways to get the values, but I want to
learn how to...
|
by: David |
last post by:
Hi all,
I have the following problem: my program works fine, but when I add option
strict at the top of the form, the following sub fails with an error that option
strict does not allow late...
|
by: YYZ |
last post by:
After reading many messages in this group, it seems that the preferred
setting for this is ON. Okay, I did that in my project (first with
..Net -- long time VB6 developer) and now a bunch of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |