Finally! OK. What you ask is not that easy and is problematic at best.
You can look into using SendKeys to stuff keystrokes into the message stream of the app you want. But since the focus can bechanged between the time you activate the app you need to send keystrokes to, or even during sending the keystrokes, the focus can change to another app.
Doing stuff with the applications windows will require you to look into the Win32 API and creating the structures and function declarations for C#. This includes something as simple as moving a window or maximizing or minimizing it. You'll have to use functions like GetWindow, GetWindowPlacement, SetWindowPlacement, SetForegroundWindow, SwitchToThisWindow, MoveWindow, ... plus all the structures that these functions use!
You might want to consider writing the bulk of this code in C++ instead of C# because all of the functions and structures already come in the header files and libraries natively used by C++ to write Windows apps.
Have fun and stock up on some Advil or Excedrin. You'll need it!
I'd like to create a ToolTip in my TreeView that acts just like the ToolTip in Visual Studio Text/Code Editor:
1. Show tooltips for each Node in the TreeView without having to move the mouse out of the TreeView and back in.
2 Show the tool tip until the mouse moves again...
The ToolTip component in the .NET base class can be used if used correctly. Try the following search[^] and find the articles by Nish and ramshri. They suggest one way of doing it.
Since the tool tip control is really just a popup window, you could always create a popup window with no border and perform a lot of the functionality yourself, like resizing it appropriately, etc. For an excellent article that takes this approach for a Balloon Window.
Not with the TreeView in .NET. The Tree-View common control - which is encapsulated by the TreeView control in .NET - doesn't support this either. There are many third-party controls out there like UltraWinTree from http://www.infragistics.com[^], and one from http://www.devexpress.com[^], though I haven't had a chance to use that one yet. We do use the Infragistics control in our application for this and many other reasons because it was far cheaper to use a third-party control rather than spend the time overriding behavior of the existing TreeView or making our own from scratch.
Actually, I just remember something that worked for a ListView (encapsulates the List-View common control) and that there was something similar in the Tree-View. It isn't easy, though, and you should have some experience with Win32 programming.
Using image lists, there is a way to hide a check box for a tree node, though it can be a bit tricky. See the documentation for the TVS_CHECKBOXES style in the Tree-View Windows Styles[^] reference on MSDN Online in the Platform SDK. It provides some basic intructions along with links to more resources. This is more of a trick with an Image List rather than the Tree-View itself.
One easy way would be to have a ContextMenu assigned to TreeView.ContextMenu (inherited from Control). Handle the Popup event and customize your MenuItems in the handler. Another way - although consuming more memory - would be to have separate ContextMenu instances and not assign anything to TreeView.ContextMenu. Handle the TreeView.MouseDown or TreeView.MouseUp events (whichever you prefer) and call ContextMenu.Show, passing the TreeView as the first parameter and the X and Y coordinates in a Point (from the MouseEventArgs) as the second parameter to Show. This calls the TrackPopupMenu native function internally.
i have a combo Box with a list like this
Now i want whenever i press 'a' the first name starting from a should be selected and if i press an then automatically 'anant' is choosen.
Please help me
You actually have to add a new DataGridColumnStyle before you can refer to it. If you step through your code in the debugger, you'll notice that .GridColumnStyles["EmployeeName"] name is null - you never created such a column. You have to create all the DataGridColumnStyles you want mapped, the DataGridTableStyle, add the columns to the table style's GridColumnStyles collection property, then add the table to the DataGrid's TableStyles collection property.
I have simular code like below
the type object in dr.ItemArray is Int16
but I can not assigne the dr.ItemArray to i (int)
i = dr.ItemArray; throws exception
Is there a method of assigning DataRow fields of number types to integer variables;
To achieve my goal I'm converting the object to string and then back to integer
i = int.Parse(n.ToString());
I think that this can not be the correct way.
Thank you in advance,
foreach (DataRow dr in clGlobal.ds.Tables["login1"].Rows)
n = dr.ItemArray;
i = int.Parse(n.ToString());