1

I have one varibale endtime which I have declared like this:

 Dim endtime As TimeSpan.

I am getting some time to this variable. example(10:00:01). I want to check my endtime is greater than or equal to 12,clock so I try to given code like this:

  if(endtime>=12)  

But it is showing error like this:

Overload resolution failed because no accessible > can be called with this argument and value type integer cannot be converted to system.timespan.

How I can compare my endtime value to other time? If any one know please help me.

user2535939
  • 97
  • 1
  • 3
  • 10
  • What the wrong i did??? while doing program i got one error. that i just posted to this sit.That s all – user2535939 Jul 17 '13 at 06:01
  • Well this site is not LearnVbIn21Days.SE. This site is for `professionals and enthusiasts` (see FAQ). A person that can not figure out how to compare two variables is neither a professional nor an enthusiast. They are a rank novice (not a bad thing, we all start there). There are more appropriate sites for them to be asking their questions. Sites (and books, and classes) geared specifically to learning a chosen language. – Sam Axe Jul 17 '13 at 06:19

2 Answers2

2

You should simply create another TimeSpan variable with the desired value and then you could compare the two variables

Dim t2 = new TimeSpan(10,0,1)
Dim t1 = new TimeSpan(12,0,0)
if t1 > t2 then
    Console.WriteLine("T2 greater than T1")
Else
    Console.WriteLine("T1 greater than T2")
End If
Steve
  • 213,761
  • 22
  • 232
  • 286
1

Try this piece of coding

endtime>= #12:00:00 PM#

Or browse to the link below

Browse Link

Community
  • 1
  • 1
VB.NET LEARNER
  • 711
  • 5
  • 11