-
No default member found for type 'Integer'
I'm trying to compare an integer to a integer on a binding source:
Dim a As Integer = pickup.PickUpID
Dim b As Integer = CInt(BindingSource.Current("PickUpID"))
If a = b Then...
On line 2 I get "No default member found for type 'Integer'"
I've tried to Integer.Parse it, and CINT it, and google it, yet no success.
Thanks for any help in advance.
-
Assuming the underlaying binding source is a database field, what is the field type of "PickUpId"?
-
Its an integer. And the first line works without any problems.
For some reason the data from the binding source doesn't want to compare. But when I check it is says {Integer}
-
First, you should have a variable to reference your BindingSource. The way the code is writte, it tries to reference the class directly. Current is not a Shared (static) property, so it cannot be call on the class.
Second, I have found with experience that direct assignment in a declaration does not always work. Have you tried this:
Dim b As Integer
b = CInt(variable.Current("PickUpID"))
CInt has also failed me a couple of time in the 6 years I have been working in .NET, while the Convert class always work. It is also preferred, since it is the .NET way, not the VB way, and can be used in all languages:
b = Convert.ToInt32(variable.Current("PickUpID"))
Jacques Bourgeois
JBFI
http://www3.sympatico.ca/jbfi/homeus.htm
Similar Threads
-
By Glenn in forum ASP.NET
Replies: 0
Last Post: 11-17-2000, 07:43 AM
-
By Yogesh in forum ASP.NET
Replies: 0
Last Post: 11-17-2000, 12:50 AM
-
By Julian Milano in forum VB Classic
Replies: 2
Last Post: 08-11-2000, 12:11 PM
-
By Arin Sime in forum XML
Replies: 0
Last Post: 06-01-2000, 03:10 PM
-
By Kunal Sharma in forum VB Classic
Replies: 2
Last Post: 04-25-2000, 03:45 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|