winforms

How to make a tab's name editable in C#?

So I have a few tabs in the form, and i want it to work like that: When you click on the tab's name, it becomes editable, and when i stop editing it remains with the new name. How would i do that with C# and winforms? ...

Some kind of error, Possibly When Viewing a Windows Form in the Designer

Hi all, I though I had solved this problem, but it is back: Code generation for property 'SelectedPeople' failed. Error was: 'Type 'ECS.Entities.Persistency.Person' in Assembly 'ECS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.' The property on the error message is a List(Of Person) and for som...

.NET UserControl: Size property gives incorrect value on Resize event

Excuse the code dump, these are functions within a UserControl private void PNGQuantPreviewControl_Resize(object sender, EventArgs e) { createOffScreenBm(); draw(); } private void createOffScreenBm() { offScreenBm = new Bitmap(this.Size.Width, this.Size.Height); offScreenGfx = Graphics.FromImage(offScreenBm);...

Calling .Parent from a form causes textbox problem, MDI

I want to make a form contained in another form. The problem is the application is already a MDI, and you can't nest MDI's. If I do childFrm.Parent = parentForm some controls behave oddly. For example, if you click on the text in the textbox, usually the text cursor appears where you clicked, but it doesn't, it just goes to the end o...

Creating controls in a non-UI thread

I have a sort of plug-in model in which various complex user controls are stored in DLLs and loaded and instantiated at run time using Activator.CreateInstanceFrom(dllpath, classname). Since I'm loading quite a few of these I wanted to do it in the background, keeping my UI responsive, by creating a new thread to do the loading. The ...

Pass current transaction or use DependentClone?

I have a WinForm application which uses SqlServer CE 3.5 as database. I use typed dataset queries for db operations. I need to use transactions for this operations. The problem is, they're scattered across different assemblies. My question is, what should I use to run all of them in a single transaction? Here's an example operation: //t...

C# write a simple string from winforms --> cmd prompt telnet

Hello, I need to pass a simple string to a command window (running telnet), from a c# winforms app... is there a simple way to do this? I tried the following, but it's all or nothing when redirecting standardinput-- the winforms app doesnt have to start the cmd window... the cmd window could already be running also-- I thought maybe t...

Visually indicating sorting in a ListView control

In Windows Explorer in XP and Vista, when you sort by a column when the ListView is in Details mode, the background of the column is highlighted to indicate that the column is being sorted. An arrow for the direction of the sort is also displayed in the column header. What are the best practices to achieving these effects in your own Win...

NGen and Gacutil best practices

Hi there, This is my first post, so please forgive me if this isn't written well. I've been working on a WinForms application which has about 5 referenced assemblies - written by us, and about 8 referenced assemblies by third parties (we wont be hoping to update them in the future unless something goes terribly wrong - Infragistics/Dev...

Where and when is InitializeComponent called in Windows Forms control in VB.NET?

I'm doing a Windows Forms project in VB.NET, but VB.NET is completely new to me, I'm primarily a C# developer. In C# Windows Forms/User controls InitializeComponent is called from the form's/control's constructor. When I create same scenario in VB.NET I don't get a constructor and I can't locate a place where InitializeComponent is call...

Catch Mouse events on unfocusable controls

I have a text box that has the focus and I want to know when the user clicked any unfocusable controls within the dialog. I cannot use textBox.Validating because this event does not fire taking in consideration that the focus will remain on the text box when clicking with the mouse an unfocusable control ...

How can I force a DropDownList style ComboBox to only open when the user clicks the drop-down button?

In C# .NET 2.0, I have a WinForms ComboBox with ComboBoxStyle DropDownList. However, the drop down appears whenever the user clicks anywhere on the combo box. Instead, I'd like to have it only open when the user explicitly clicks on the drop down button. When the user clicks on the rest of the combo box, I'd like to just assign it the...

Localization, how to use a specific resx

Today I'm playing with localization. I have a winforms app where I've set localizable to true on my screen, then I went and converted all the text to spanish as best as I could. So now I have my screen.resx and my screen.es.resx and everything looks good/bueno. How do I now run my app and have the spanish version come up? I tried going i...

Horizontal scroll winforms listview

Anyone know if its possible to enable horizontal scrolling ONLY in a windows forms listview (viewmode set to large icons). What I want to do is make a listview whose height is sufficient to only show one row of icons, and I don't want to have multiple rows. Just one very long row that a user would have to scroll horizontally to get to ...

Multiple Drag and Drop actions on one control

I have a windows form that contains two usercontrols. One usercontrol contains two list views. The other usercontrol has a grid. Within the first usercontrol the two list views drag and drop their contents between each other. The grid usercontrol is setup to dragdrop onto the listview usercontrol. The problem is that the drag drop eve...

Custom User Control in C#...Right Click Menu to Copy Text (Java Developer learning C#)

I'm working on a custom user control that essentially displays a name value pair (name is on a black background, value on a white). I have my control displaying correctly, even showing up in Designer and on my build page. What I'd like to do from here is have the ability to right click on the user control and have a menu come up that ha...

Open/close a winform application from ASP.NET

Is there a way to open/close (i.e. start-up/shut-down) a winform application via ASP.NET? I'm sure this reeks of a security violation, but the application of this technique (if it's even possible) would be in a controlled environment. I assume extra permissions would need to be granted to the web server or the web application, but I'...

Distributing localized winforms app

This is related to my early post today: link text So now I have demo winforms app with two different localizations, one english, one spanish. Now let's say I have a big app, let's say it supports localizations in 15 different languages. In the previous post, it was suggested that I add a few lines when the form is initialized to set the...

Getting the item under mouse cursor in a listview control?

Basically I am trying to implement a feature where if the user presses a key, I want to find out the item under the mouse cursor. So I don't use Mouse events but Keyboard events which doesn't give me a ListViewItem of course. I just don't know in what space I need to get the mouse position and convert it into the control's space. Any ...

How to configure .NET's WebBrowser to obey the current language settings

I am using the System.Windows.Forms.WebBrowser object for displaying and printing a report. Unfortunately the Page Setup dialog is not obeying the language settings on the user's computer and all of the text is coming up in English. The .NET dialogs for opening and saving a file are coming up in the correct language but not the Printing/...