Using Is To Compare Objects?
Jan 2, 2010
So I am working on a project with a lot of pictures in my resources and I am trying to check what picture has been put into a part of my array. I am using structures in my array and i'm not sure if that will make a difference.
If logs(i).pic Is My.Resources.Log2 Then
logs(i).gap = 70
End If
[code]....
View 2 Replies
ADVERTISEMENT
Aug 28, 2008
I want to compare two objects to check if all the properites of both the object have same value or not. for this i need to use the reflection to enumarate through all the properties of an object and check the value of the property. To try the code just i have written a Employee Class having Two Properties EmployeeNo and EmployeeName. I am creating an object of the Employee class and need to write a function that can list the values of all the properties in the class.
[Code]...
View 2 Replies
Feb 10, 2010
I want to test if the 2 objects values can be compared.
For example if I have a variable define as an object which contains a value of "A" and another variable defined as an object with a value of 0. (These must be defined as type Object.)
When I do a simple compare If Object1 <> Object2 Then etc. I get an error. So how do I test to see if the objects are comparable? I have looked at TryCast , DirectCast, Ctype etc but cannot see
View 6 Replies
Jan 17, 2012
I am attempting to compare a bitwise clone object to its parent to check for changes using:
If Not objCP.Equals(objCPClone) Then
'do something
End If
and it always compares as not equal even immediately after creating the clone. How should they be compared to check for changes?
View 2 Replies
Oct 12, 2010
I want to compare two objects whose type may be diffrent.
For eg, I expects 'true' for comparing 1000.0(Decimal) with 1000(Double) . Similary, it should return true if I compare 10(string) and 10(double) .
I tried to compare using Object.Equals() , but it did NOT work.It return false if two objects have different data types.
Dim oldVal As Object ' assgin some value
Dim newVal As Object 'assgin some value
If Not Object.Equals(oldVal,newVal) Then
[Code]....
View 5 Replies
Jun 16, 2010
I have a connection string set up and a data reader.I have two textboxes on my form for users to type in. One textbox (txtLogin) is a user name and the other textbox is a password (txtPwd). I'm trying to compare what a user types into those two boxes to a table in a vfp database. The table I'm trying to compare to is open about 99% of the time so I need to be able to read from it in some type of "shared" mode.
My Select statement needs to be something similar to "select * from sites where clogin = txtLogin.text and cpassword = txtPwd.text"I just don't know how to get this to work properly.
View 2 Replies
Sep 14, 2010
I am trying to compare specific properties within two objects. Example:I want to compare the Last Name, Age, and Sex of two people (Person1 and Person2).
View 3 Replies
Jun 18, 2009
Is there a way to compare two dates (which include time) ignoring the time? I have a 1/1/2009 8:00am and 1/1/2009 9:00am and I just want to know if it is the same day, without any care to what time it is. I know I can convert the date and compare the strings, but is there another way?
View 2 Replies
Jan 12, 2011
What's a sound approach to override the CompareTo() method in a custom class with multiple approaches to comparing the data contained in the class? I'm attempting to implement IComparable(Of T) just so I have a few of the baseline interfaces implemented. Not planning on doing any sorting yet, but this will save me down the road if I need to.
Reading MSDN states mostly that we have to return 0 if the objects are equal, -1 if obj1 is less than obj2, or 1 is obj1 is greater than obj2. But that's rather simplistic.
Consider an IPv4 address (which is what I'm implementing in my class). There's two main numbers to consider -- the IP address itself, and the CIDR. An IPv4 address by itself is assumed to have a CIDR of /32, so in that case, in a CompareTo method, I can just compare the addresses directly to determine if one is greater or less than the other. But when the CIDR's are different, then things get tricky.
Assume obj1 is 10.0.0.0/8 and obj2 is 192.168.75.0/24. I could compare these two addresses a number of ways. I could just ignore the CIDR, and still regard as obj2 as being greater than obj1. I could compare them based on their CIDR, which would be comparing the size of the network (and a /8 will trump a /24 quite easily). I could compare them on both their numerical address AND their CIDR, on the off chance obj2 was actually an address inside the network defined by obj1.
What's the kind of approach used to handle situations like this? Can I define two CompareTo methods, overloaded, such that one would evaluate one address relative to another address, and the second would evaluate the size of the overall network? How would the .NET framework be told which one to use depending on how one might want to sort an array? Or do some other function that relies on CompareTo()?
View 1 Replies
Mar 3, 2010
I have two textbox in my application.
Textbox1.Text="19-Jan-2010"
Textbox2.Text="Jan 2010"
May I know how can I compare that Textbox1 and Textbox2 text is within same month and same year?
View 1 Replies
Dec 5, 2011
make objects from the ToolBox using code instead of changing existing objects invisible then visible later?
View 7 Replies
Jun 23, 2012
I am getting this error, Not sure why it is happening "Error The SqlParameterCollection only accepts non-null SqlParameter type objects, not Int32 objects."I have tried with all sorts of possibilties, now try to enter default data as dummy data,
Using connection As New SqlConnection
connection.ConnectionString = ConfigurationManager.ConnectionStrings("DentalDeviceConnectionString").ConnectionString
connection.Open()[code].....
View 1 Replies
Jan 29, 2011
I have a program like this.
Module Module1
Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....
But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.
View 1 Replies
Jan 6, 2011
I want to let the user input objects to a richtextbox 1 object on each line, and somehow use Random.Next to select pseudorandomly a few objects, the number 'few' inputted in a textbox.
View 9 Replies
Jan 18, 2012
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using conn As New SqlConnection("Database=Clinic_Management_System;Data Source=.SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|Clinic Management System.mdf")
Dim cmdRecord As SqlCommand
[code]....
View 2 Replies
Feb 7, 2010
I have a user control that inherits the FW ListView and I need to dispose of two objects when the form's disposing of it's objects. Here's what I've concluded already, am I on the right track?
[Code]...
View 3 Replies
May 20, 2011
they need to make some compare version between host version and client version.. and each 1 version different will download the file to the client..[URL]..with both example, how can i make a program in VB.NET just like i said just now?
View 15 Replies
May 1, 2009
long story short, I have created a ListView type control, using UserControls for the parent control and the ListViewItems. Most the of the control is written and works fine, right up to the point where I tried to replicate the 'Control.SelectedItems(0).Index' property and the 'SelectedIndexChanged' event.
Each child object knows its index value, and could pass this value via the SelectedIndexChanged event (assuming this is how it works in a normal ListView control -- user clicks on an item, and that item fires an event updating the selected index value in the parent object).
How does the child object raise an event in the parent object? I have a feeling this could be done with Delegates, but I'm still learning about their usage.
View 1 Replies
Aug 9, 2011
getting the following error Unable to cast object of type 'System.Object[]' to type 'OrderService.webdirect_WebLinesRow[]'. On the line
webdirect(web_companyID, web_locationCode, web_customerNumber, web_orderNumber, web_orderReference, web_orderDate, webLinesArray.ToArray(), o_Company, o_LocationCode, o_CustomerNumber, o_OrderNumber, o_OrderStatus, o_OrdDescrip, webRespArray)
I created the webLinesArray.ToArray() array as such
Dim webLinesArray As New ArrayList()
Am I missing an additional cast or something ?
View 1 Replies
Jul 21, 2009
I am tring to bind a class to a form where the class contains other class variables. For example:
Class Character
Private _name as String
Property Name as String
[code]......
View 5 Replies
Jan 3, 2012
I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:[code]
1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?' this raises error: dim cls2(n) as new class2 end sub.
2) How can I return actual number of Node() array? [code]Outside my class in main project I define cls1 object:[code]Now an array of class2 is created inside cls1.
3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?
I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.
View 1 Replies
Jan 24, 2010
I need two seperate lists, which every item is Integer, String, Bitmap - and one which every item is Integer, String String. However I don't know how to do this, or even where to look - I've googled for custom objects and custom object lists. What I'm trying to do is this.Custom Object1 is Integer, String, Bitmap Custom Object2 is Integer, String, String
In one thread I'll be adding items to List1(Of Object1), and processing them, and adding the results to List2(Of Object2), however I need to be able from other threads to look at the list and say only give me the items where Integer = (my thread ID), is this possible? Any help, or even links to information that would be relevant to this request would be helpful?
View 2 Replies
Dec 15, 2009
[Code] I want that once I put something in the BigCollection it stays there, I don't want it to be changeable from outside. I want to be able to clear the SmallCollection but it should not be cleared in the BigCollection. Any Ideas?
View 1 Replies
Feb 6, 2012
Firstly I need somebody to explain a bit of code to me, I'm a massive newbie at programming so I need an in depth explanation.
Private Sub Box_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim C As PictureBox = CType(sender, PictureBox)
[code].....
View 2 Replies
Apr 7, 2011
i need to make sure a labels.text and a labels2.name are equal. figured it was straight forward i renamed the label the same name as the label im comparing it too but it comes up false.
View 1 Replies
Oct 7, 2011
We would like to compare a date from the db with current date. Here is what I have tried so far: 'Obtain current date Dim curdate As String = Now.ToString("yyyy") 'Now compare curdate with date from db called eventdate. Event date is of dateTime datatype. If drv("eventdate").ToString = "" And Year(drv("eventdate").ToString) = curdate Then
[Code]...
View 3 Replies
Jul 28, 2009
I have 2 date ranges with 2 text box, based on that m populating reports.
I want to do in such a way if fromdate and todate <27/06/2009 then it should call come other SP otherwise diff one
[Code]....
View 6 Replies
Jun 19, 2010
Okay what i what to do is to compare one picture to another continuously untill it finds a change and then launches my code. Picture 1 - A picture i put to the form Picture 2 - I wont this to take a picture in a certain area and compare it to the first picture. lets say the first screen shot it took didn't match 'Picture 1' then it will keep taking pictures until it finds something different and when it finds something different it will launch my code.
I dont know if this is the right way to go since i heard something about pixel scanning but that's to hard since you have to find the exact RGB of that pixel. Also theirs like billions on the screen so it would be hard to find a change of color on the screen and then launch a code after that and keep repeating.
View 17 Replies
Sep 1, 2011
I am working on my program as I have created picturebox1 and splitter1 in my program. I am coding on the if statement as I am trying to compare on the value that if they are less than 184, then do something.
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
If Splitter1.Location <= New System.Drawing.Point(184, 0) Then
[Code]....
I know that I can't compare the value using with <= which I will only have to use = instead of <=, but i still want to compare with the value that if it less than 184, then do something.
View 5 Replies
Oct 21, 2011
I just put 2 datagridview in form1 and both datagridview got filename and MD5 hash. but some data in datagridview1 and datagridview2 got different MD5 hash but same filename.. but how can i compare both MD5 hash and put it into another datagridview (datagridview3)
View 5 Replies