please help!!!
i have a datagridview on my form with customers info which is linked to my database. i want to execute a line of code based on the information in one of the columns in the datagridview??? for example i have a datetime column which stores dates(and maybe time) i want to use an if statement(or any code) to compare the date the customer entered. if its today then my code will execute!!


please help me on how to do this
thanks a lot in advance
God bless

hello!
try this code

dim i as integer
for i = 0 to datagridview1.rows.count-1 
 if datagridview1.item(2,i).value.tostring =   Now.Date.ToString() then 
 'now here put your code you want to execute
endif
next

Hope this will helps you if yes then please mark your thread solved and vote me up :)

Regards

thanks
but there was an error, it says "i tried to use an object without providing an instance of the object."for "if datagridview1.item(2,i).value.tostring = Now.Date.ToString() then"

ok well use this , may be this will solve your prob

dim i as integer
dim a as string 
for i = 0 to datagridview1.rows.count-1 
a = datagridview1.item(2,i).value.tostring()
 if a =   Now.Date.ToString() then 
 'now here put your code you want to execute
endif
next

Regards

tank you soo much!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.