On my computer, I have installed share point 2010 and visual studio 2010. Is is possible to develop web part for share point 2007 from my machine? I can not create new project in VS for share point 2007. Will web part, or visual web part, developed for SP 2007 work on SP 2007?
I'd recommend you to use my favorite (when I worked with 2007) Visual Studio add-in for SharePoint 2007, SPVisualDev.
SPVisualDev makes it easier for Sharepoint 2007 developers to develop features and artifacts with Visual Studio 2008 / 2010. It is written in C# and is implemented as a Visual Studio 2008 / 2010 Add-in.
This add-in is absolutely great, it allows remote development and has many wonderful features. In fact, it is even more powerful and handy than current combination of SharePoint Developer Tools 2010 and CKS:Dev Add-In.
And you can use it with SP2007 and VS2010, as it mentioned in the project description. Even better, since it supports remote development (in a VM, for example) with SPVisualDev, I believe there is no need for SP2007 on the local machine at all, or probably you will need to install only several SP2007 dlls to GAC, to reference them from the Visual Studio.
You need Visual Studio 2008 and SharePoint 2007 to develop SharePoint 2007 web parts. You will find a web part developed for 2010 will not deploy to a 2007 farm.
If you have to switch between 2007 and 2010 (which is common, while companies are migrating over) I would recommend you use virtual machines for the two environments. Develop in the relevant VM for that SharePoint server.