Hi everyone! How do I make a drop-down menu in vb 2008. This menu would appear when the user right-click anywhere in the form. The menu that I am referring to is just like in windows when you want to refresh your computer, open a file, copy or cut some files. Secondly, does anyone know how to filter the content of a datagrid in vb 2008 by date. I want to display only those records where the due_date field is lesser than the date today. My code which goes like datasource.filter = "Due_Date < '" & now & "'" works only when the two dates are of the same month. When the due_date is behind by one month, it doesn't work properly. I know this is a kind of complex question so let's just put it this way. How do I filter a datagrid when dates are involved. My database is Access 2007.

Thanks, I hope someone can be my angel

Recommended Answers

All 3 Replies

That "menu" you are referring to, in vb.net is called a ContextMenuStrip.

The ContextMenuStrip can be located in the Toolbox under the "Menus & Toolbars" tab.

Double click the ContextMenuStrip control in the Toolbox and you should get a "ContextMenuStrip" with a "Type Here" right under it on the Form.
That "Type Here" is where you add your options for the context menu, for example Cut, Copy, Paste, etc.

After you add a few options, double click a option you have added and add the appropriate code for that event.

To assign the ContextMenu to Form1, locate the "ContextMenuStrip" option in the Form's Properties and select the ContextMenu you want to use.

You can also assign different ContextMenus for different controls just by following the provided information above.

About your "Secondly,..." question, not my field of coding.

For future references markdean.expres, please limit your thread question to one question, unless it relates.
Good luck with the "Secondly,..." and as DaniWeb says, all the best.

Well, thanks Codeorder . You have really given me the very best answer to my question....

For the second, the problem is related on how a date is mantained internally and the way is parsed. For a date of 04/03/2010 is this March 4th or April 3rd?
Instead of Now() use

Format(Now(),"yyyy-MM-dd")

This will present allways your date in the 'universal' format expected to be 2010-03-04 (March 4th, 2010)

Hope this helps

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.