|
Then you are handling the wrong click event - the DataGridView Click event always passes the DataGridView as the sender. Are you handling the Context Menu strip Click event instead - in which case the Click event sender will be a context menu strip?
BTW: Don't post in two places (as someone mentioned under Q&A) - it duplicates effort and annoys people. Go back and delete your Q&A version.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
|
I thought of deleting it myself, but I prefer to let them know why not to do it - hopefully they won't next time. (yeah, right, when pigs floss)
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
i understant,
but i neet to start my function when the event of the menuStrip click fired...
|
|
|
|
|
So? You have the individual menustrip item click event, which tells you the user wants to do something, and what he wants to do. And you have the DataGridView click event which tells you that the user has left - or right - clicked and on which DataGridView he clicked.
Put the two together and something magical may occur...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
I believe you are are after the owner of the contextmenu click event. this is a sample from one I found to solve that problem.
ToolStripDropDownItem menu = (ToolStripDropDownItem)sender;
ContextMenuStrip strip = (ContextMenuStrip)menu.Owner;
ListView oLV = (ListView)strip.SourceControl;
There may be a more elegant way to do it but this works.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have an application in C# that use SQL Server 2008 R2 Express.
When i install the package i need to choose option and to install:
1. Microsoft .Net Framework 3.5 SP1.
2. Windows Installer 4.5.
3. Windows PowerShell 1.0
I have an SQL Script that will build my DB at SQL 2008 R2 Express and will add the user configuration that i want.
I want to make install package that will include the SQL 2008 R2 Express (including "Microsoft .Net Framework 3.5 SP1.",
,"Windows Installer 4.5" and "Windows PowerShell 1.0 ").
Will run the script and install my application.
I don't want to let the user to choose configuration for the DB in the installation process.
How can i do that?
Thanks,
Shai.
|
|
|
|
|
Already posted twice elsewhere.
It's time for a new signature.
|
|
|
|
|
|
My preference, and I think there are others here who agree, is to not try to do that.
Simply document the system requirements of the application and let the user install what's needed however they like.
Think of it this way... what if your install installs today's current features, but a user wants to install it sometime in the future and doesn't want to install "old" versions of this stuff.
Plus, the user may already have the stuff you require installed (or better). Why install SQL Server Express when the user already has the full package?
Or maybe the user wants to have SQL Server on a server (where it belongs), not on his workstation?
Your install should install your application and nothing else.
|
|
|
|
|
Indeed, don't force your customer to install sql express. I agree to PIEBALDconsult post.
Maybe its the easiest way to create your installation, but its the wrong way. Your installation should get the required data (connection settings etc.), check the connection, then it should install the database. If the connection fails, cancel the setup.
|
|
|
|
|
Hi
I am currently learning to use a directshow.net library and I would like to be able to catch a double click event on the video. Is this possible and if so how do I do it?
Thanks
|
|
|
|
|
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_GRAPHNOTIFY:
{
}
break;
case WM_LBUTTONDOWN:
{
}
break;
}
I know nothing , I know nothing ...
|
|
|
|
|
protected override void WndProc(ref System.Windows.Forms.Message m)
{
const int WM_NCLBUTTONDBLCLK = 0xA3;
if (m.Msg != WM_NCLBUTTONDBLCLK)
{
}
base.WndProc(ref m);
}
I know nothing , I know nothing ...
|
|
|
|
|
This is the non client double click message. Is there a double click message for inside the client area?
|
|
|
|
|
I used 0x0203 and it's worked for me...
|
|
|
|
|
Hello,
I'm writing a Windows service in C# .Net 4.0 with MS VisualStudio 2010.
I have a problem now:
How can I find the path to the installutil.exe?
or how can I install my service using C#?
I searched with google and I found soulutions, but they don't work.
Sorry for bad english.
Thanks for all responses
|
|
|
|
|
I use System.Configuration.Install.ManagedInstallerClass.InstallHelper , which is the routine that INSTALLUTIL calls. (I have lost track of which article here pointed it out to me.)
In the Main method of my service program I accept a command-line pararmeter and use a switch:
case Action.Install :
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper
(
new string[] { System.Windows.Forms.Application.ExecutablePath }
) ;
break ;
}
case Action.Uninstall :
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper
(
new string[] { "/UNINSTALL" , System.Windows.Forms.Application.ExecutablePath }
) ;
break ;
}
So then I call my program rather than INSTALLUTIL to perform actions on my service(s).
|
|
|
|
|
Thank you!!!
I have it realized and it works fantastic good now!
Thank you very much
|
|
|
|
|
|
I have been using this code for a while now and it has been working well. I have just switched to Windows 7 and was starting a new project to create a service configuration and installation tool. I reused this code and it fails on Windows 7. The error is "The installation failed, and the rollback has been performed." I suspect that permissions need to escalated and the user needs to approve this action for it to succeed. I have done some research and have tried to work around it but the user is never prompted. Does anyone know how to get this to work on Windows 7? I assume that Vista would have the same problem as well.
|
|
|
|
|
Ah, I have only used it on XP and Vista (as administrator)... hang on, I think I have a Win7 virtual machine around here...
Hmmm... OK, I got the same thing. Ferb, I know what we're going to do today.
Edit: In looking at the messages I see: System.NullReferenceException: Object reference not set to an instance of an object .
modified on Friday, July 30, 2010 12:03 PM
|
|
|
|
|
Oh, yeah, I think I may have had that on Vista too. Because I use a DOSbox to control my Services from the command-line, I simply run it as Administrator.
I was able to install and start my Service on my Windows 7 virtual machine, but I wasn't able to access the SQL Server instance on this system.
|
|
|
|
|
|
But I believe he was concerned about finding the correct version on some unknown user's system.
My system currently has three versions:
C:\windows\microsoft.net\Framework\v1.1.4322\InstallUtil.exe
C:\windows\microsoft.net\Framework\v2.0.50727\InstallUtil.exe
C:\windows\microsoft.net\Framework\v4.0.30319\InstallUtil.exe
Other systems may have fewer, and there will likely be new versions in the future -- his install would need to detect which is available and will work.
I may have written an application with .net 2 that expects the .net 2 version -- but today someone may want to install it on a system with .net 4 only.
The .net 4 version will work, but the install won't know it's there and so will fail.
Of course, this is what the PATH environment variable is supposed to be used for, but I think I'm the only one who still uses it.
|
|
|
|