winforms

defining problem

friends,where should i define FavoriteMenu to work this code? becouse it gives error:The name 'FavoritesMenu' does not exist in the current context i solved above problem,i didnt define a contextMenuStrip for it.when i defined,that problem solved but now say The name 'MenuItems_Click' does not exist in the current context. should i name...

Delay Keypress until TextBox is enabled

My custom Control displays a TextBox when a key is pressed (basically to allow for numeric input). It's easy enough to show the TextBox from inside the KeyDown event on the main control, but how do I pump the keypress into the textbox? ...

richtextbox text range attributes -- protected, hidden, backcolor, etc -- can i set them without selecting a range?

i want to be able to protect, hide, and highlight different ranges of text within a richtextbox without actually selecting the text -- which is what you seem to have to do for the SelectionProtected and SelectionBackColor or w/e properties. how can i do this programatically? I looked around in reflection and found the SetCharFormat met...

New Thread for Instance of a Class (C#)

I have a form and several external classes (serial port, file access) that are instantiated by the form. 1) What's the simplest way to run an instance of an external class in its own thread? 2) Is the instance's thread automatically terminated when the form closes? ...

marking a WinForms Button as serializable

This is my very first program for serialization. An error occurred when trying to serialize a button control. public Form1() { InitializeComponent(); CheckSerialization(); Button btn = btnSerialized; } public void CheckSerialization() { Stream write = File.OpenWrite(@"C:\ser.bin"); ...

Optimization resulting unreachable code

i created one flag Method1HasExecuted ,,the logic which i wanted to achieve is if that flag true i need to do this function rp = Spa.Modify(val); otherwise return rp as false.For that i did like this if (Method1HasExecuted) { rp = Spa.Modify(val);//Save operation, this function also return boolean value ...

Layer effects (blur, etc.) in WinForms

In WinForms, I’m looking for a way to achieve the functionality similar to that of JXLayer class in Java’s Swing. To be more specific. I’d like to blur entire content of a window, and paint something over it (a waiting circle, for example). Any ideas will be highly appreciated :) ...

how to force my C# Winforms program run as administrator on any computer ?

hi how to force my C# Winforms program run as administrator on any computer ? and any kind of OS ? i need code solution (any sample code will be excellent) thank's in advance ...

IPreviewHandler throws uncatchable exception

I've imported the COM interface IPreviewHandler into a WinForms app and am using it to display previews for various types of documents (I look up the GUID of the appropriate preview handler in the registry, then use Activator.CreateInstance(guid) to instantiate the specific COM class. This works wonderfully for the vast majority of file...

How to prevent a C# Winforms program from appearing in Task Manager?

How to prevent a C# Winforms program from appearing in Task Manager? ...

How to do a mailing using a reporting tool?

Env.: Reporting Services or XTraReport, SqlServer Express 2008 R2, VS2008, WinForms, C# Hi All, My WinForms app must send a customized letter to a bunch of people (whose contact info is in SqlServer). This is the typical job for Word Mail/Merge. But I'd like to do it without Word installed on client computers. I'd rather use MS Repor...

WPF WindowsFormsHost does not bubble up untreated key gestures

Ok, I'm not sure I understand how this should work, but in my app I have bound a key gesture (Ctrl+K) to a RoutedCommand. No matter where I focus in my app, the key combination works, except if I use it inside of a WindowsFormsHost containing a web browser control. I tried capturing the PreviewKeyDown event for the web browser control an...

Treeview issue while renaming the node

Hi all i have written a code to rename the node of a treeview. While editing if i erase all the text and hit enter it is getting renamed but if the user enter some text with an extensioin .txt then only i would like to rename that name. I debugged my solution erasing all the text gives "" so that it is not checking the condition what to...

How Can I Create Folders in the Installation Process?

I haven't deployed the application yet. I'm new to this, how can i create folders under C:\Programs Files during installation? Should i put the snippet of creating folders in program.cs? The application is Winform in C# ...

How do I configure a C# program to run when the Operating System is first started?

How do I configure a C# program to run when the operating system is first started? ...

Control difference between Hide() and Visible?

I was wondering about the difference between using a Control’s Hide() method compared to setting the Visible property to false. When would I want to use the one over the other? ...

What is the closest equivalent to Qt's form layout in .NET?

What is the closest equivalent to Qt's QFormLayout in .NET? ...

Interop directly with office graphing component from c#

I am working with a legacy application that uses the office graph.exe ( C:\Program Files\Microsoft Office\Office14\graph.exe ) I add a reference to the graph.exe component in my c# project and when I try to initialize the component I use: using Microsoft.Office; Interop.Graph.GlobalClass c = new .Interop.Graph.GlobalClass(); Interop....

Context Menu not showing up in tabPage

Hello everyone, I have this scenario: A windows forms application, which contains: a QTabControl (from Qios DevSuite) created in design view; a QTabPage created programmatically; a geckoWebBrowser inside the QTabPage, created programmatically as well. The problem: I have 2 events in the QTabPage: QTabPage.MouseDown - executes pe...

Setting the .Top property, removes the Anchor property

I have used Anchor property for some of my controls at design time. but when I change the .Top property of those controls at run time, it seems that it is messing with the Anchor property and does not honor it anymore. what is happening? how to fix? ...