Hello,
I am converting an app from VB6 to VB.Net and have
encountered the following problem. I have the following
loop which retrieves objects from a collection of objects.
Dim entry As Domino.NotesViewEntry
Dim obj As Object, str1 As String
....
For Each obj In entry.ColumnValues.ToString
If IsArray(obj) Then
str1 = obj(0) '<---problem with this line - vb6 syntax
Else
str1 = obj.ToString
End If
Next
the error message says Option Strict doesn't allow late
binding. What would be the correct syntax for handling
this?
I also had a problem with entry.ColumnValues (VB6
syntax). I added .ToSting but haven't tried this yet
(hope it works - entry represents a Lotus Notes document
in a Lotus Notes view - equivalent of a record in an rdbms
system).
TIA,
Rich 3 3962
"Rich" <an*******@discussions.microsoft.com> schrieb Hello,
I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of objects.
Dim entry As Domino.NotesViewEntry Dim obj As Object, str1 As String ... For Each obj In entry.ColumnValues.ToString If IsArray(obj) Then str1 = obj(0) '<---problem with this line - vb6 syntax Else str1 = obj.ToString End If Next
the error message says Option Strict doesn't allow late binding. What would be the correct syntax for handling this?
I also had a problem with entry.ColumnValues (VB6 syntax). I added .ToSting but haven't tried this yet (hope it works - entry represents a Lotus Notes document in a Lotus Notes view - equivalent of a record in an rdbms system).
If you use ToString, the loop iterates through all chars in the string, so
str1 would have to be declared as Char - and obj(0) wouldn't make sense.
What is the type of the items in entry.ColumnValues?
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
I declared the variable entry as a Domino.NotesViewEntry
object. So entry represents a row of data in a Lotus
Notes View (similar to a record in a Sql Server view) with
columns/fields. In my scenario, the data is all text data
(numeric text, date text, and char text). If I leave
Option Strict off I can use the syntax below, but with
Option Strict on I run into problems, like late binding
issues, entry.ColumnValues is regard as a System.Object
object, etc. I have posted requesting syntax for using
Option Strict on with these issues:
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
<<
how can I handle this with Option Strict On in vb.Net?
Thanks,
Rich -----Original Message----- "Rich" <an*******@discussions.microsoft.com> schrieb Hello,
I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of
objects. Dim entry As Domino.NotesViewEntry Dim obj As Object, str1 As String ... For Each obj In entry.ColumnValues.ToString If IsArray(obj) Then str1 = obj(0) '<---problem with this line - vb6 syntax Else str1 = obj.ToString End If Next
the error message says Option Strict doesn't allow late binding. What would be the correct syntax for handling this?
I also had a problem with entry.ColumnValues (VB6 syntax). I added .ToSting but haven't tried this yet (hope it works - entry represents a Lotus Notes document in a Lotus Notes view - equivalent of a record in an
rdbms system).
If you use ToString, the loop iterates through all chars
in the string, sostr1 would have to be declared as Char - and obj(0)
wouldn't make sense.What is the type of the items in entry.ColumnValues?
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
"Rich" wrote: I declared the variable entry as a Domino.NotesViewEntry object. So entry represents a row of data in a Lotus Notes View (similar to a record in a Sql Server view) with columns/fields. In my scenario, the data is all text data (numeric text, date text, and char text). If I leave Option Strict off I can use the syntax below, but with Option Strict on I run into problems, like late binding issues, entry.ColumnValues is regard as a System.Object object, etc. I have posted requesting syntax for using Option Strict on with these issues:
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)
That's true - late binding is not allowed with option explicit on - which kinda sucks :(
anyway - you could use one of these:
str1 = DirectCast(entry.ColumnValues(0), String)
or
str1 = CType(entry.ColumnValues(0), String)
basically, both are casting functions.. 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
this doesn't work because i dont think entry.ColumnValues is returning an array
and even if it did, you might have to do something like
Dim obj() As Object = entry.ColumValues()
but i'm not really sure about that..however, if entry.ColumnValues is return a
collection of some other objects, i dont think you can directly assign the collection
to an array of objects; i would think that wouldn't work even if you had option
explicit off. 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
the above statement works because in .NET all reference types are natively of type
'Object'; so you can assign any type to an object. <<
how can I handle this with Option Strict On in vb.Net?
Thanks, Rich
hope this helps a bit..-----Original Message----- "Rich" <an*******@discussions.microsoft.com> schrieb Hello,
I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of objects. Dim entry As Domino.NotesViewEntry Dim obj As Object, str1 As String ... For Each obj In entry.ColumnValues.ToString If IsArray(obj) Then str1 = obj(0) '<---problem with this line - vb6 syntax Else str1 = obj.ToString End If Next
the error message says Option Strict doesn't allow late binding. What would be the correct syntax for handling this?
I also had a problem with entry.ColumnValues (VB6 syntax). I added .ToSting but haven't tried this yet (hope it works - entry represents a Lotus Notes document in a Lotus Notes view - equivalent of a record in an rdbms system).
If you use ToString, the loop iterates through all chars
in the string, sostr1 would have to be declared as Char - and obj(0) wouldn't make sense.What is the type of the items in entry.ColumnValues?
-- 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: Francesco |
last post by:
Ciao,
I'm new in c++ programming and I've experimented some method to convert
real number into c++ string object, at present I've found as best solution
use the C command "sprintf":...
|
by: Thomas |
last post by:
It looks like the String.replace doesn't work in IE6.1. Anyone else
has the same problem. I am using newest service package of IE and
Win2K.
Thanks
|
by: Christopher Benson-Manica |
last post by:
<html>
<head>
<script>
var s=String( 'foo' );
alert( s );
s.bar='bar';
alert( s.bar );
</script></head></html>
Why does the second alert produce 'undefined'? Are string objects
|
by: cnickl |
last post by:
I’m not sure where to post this, so I post it here. It’s more like a VC++.NET
/ Managed Code problem. Probably easy to fix for you guys.
I want to use a String object as a parameter for a...
|
by: Mike Moore |
last post by:
does anyone have an example of how to get the connection string object
converted to a string variable type in order for me to call a function?
|
by: rengeek33 |
last post by:
I am building a SQL statement for Oracle and need one part of it to read:
, myvar = null, myvar2 = "1", myvar3 = "0", myvar4 = null,
etc.
I am constructing this string using the String...
|
by: lovecreatesbea... |
last post by:
Is it correct and safe to compare a string object with "", a pair of
quotation marks quoted empty string?If the string object: s = ""; does
s contain a single '\'? Is it better to use...
|
by: silverburgh.meryl |
last post by:
Hi,
If I have a std string object , how to convert a STD string object to
an integer?
Thank you.
|
by: OccasionalFlyer |
last post by:
I'm trying to overcome limitations in a function by passing a string
object rather than a string primitive. The code to set the string
object's attributes, however, seems to have no effect:
var...
|
by: David Lazos |
last post by:
Hi All,
I use Contains method of String object to determine if a string variable
has another string, like that.
***************************
ipAddress.Contains("127.0.0")...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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: 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...
| |