winforms

How to customize message box

I am doing C# application, and I want to change the style of a message box. Is it possible or not? Example: change button style, fore color, etc. ...

Weird Winforms Bug?

I'm making a Calendar application for myself to use, and to learn. I've had no trouble until now with mutliple forms, and opening new ones on top of each other, etc. Here's an example: private void button1_Click(object sender, EventArgs e) { if (ceForm != null) ceForm.Close(); ceForm = new CalendarEventForm(); ceForm.Show(...

C# Form X Button Clicked

How can I find out if a form is closed by clicking the X button or by (this.Close())? ...

C# : When modifying a tablelayoutpanel, controls in another tablelayoutpanel disappear

The two tableLayoutPanels have nothing in common. In the first one, adding a specific row just makes all the Labels (and not the others controls) of the second tableLayoutPanel dissapear! Has anyone encountered this problem? Solved it? ...

Performance testing of Windows Forms application

We have a very old windows forms application that communicates with the server using .net remoting. Can anyone recommend a method or a tool to performance test this. ...

Enumerating ListView.SelectedIndices is slow on huge ListView

I have a ListView with VirtualMode = true and huge number of items (for now ~800,000). My goal is to sum a field in all selected items, each time selected items changed. The problem is that enumerating all selected items takes long time when huge number of items are selected. for example, it takes 1 second for enumerate 800,000 selecte...

Cancel A WinForm Minimize?

Hi, I have a winform with the minimizeMaximizeClose buttons disabled, but still if someone presses it in the task bar, it will minimize. I want to prevent this from happening. How can I accomplish this? ...

How to Dynamically Create Tabs

This is in C# I Need to basically make TabPages from a textbox.Text so for example: textBox1.Text = "test"; TabPage textBox1.Text = new TabPage(); That is what i want to do.. i know that won't work directly, but that should give you the idea of how i want to create the tabPages.. then i want to be able to call them later on too so fo...

WinForm Application Prevents Machine Restart?

I have a WinForm application, and when it's open and I try to restart my computer, my computer just hangs and doesn't restart. I have to actually close the WinForm app, and then restart, and my computer restarts. What can I do to solve this? private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (!...

Subconic3.0 with winform app

Can subsonic 3.0 be used with a winform app? Do I need to add any references to the system.web? If it can be done, how can I exclude certain tables in the DB? Can I use the following whih I am using for subsonic 2.0 <providers> <!--<clear/>--> <add name="TEST" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="myString...

Setting DataGridViewTextBoxCell.Value in formLoad? Impossible?

I am trying to set a DataGridViewTextBoxCell.Value in formLoad, which kind of works, I can set it, but nothing is displayed. DataGridViewTextBoxCell cel = (DataGridViewTextBoxCell)gvAirSegment.Rows[rowNumber].Cells[0]; cel.Value = "TEST"; This works, on button click, but does not work when its within a Form_Load. I have tried Refresh(...

How to protect my .net winforms assembly from customers of a customer.

This question appears to have died, so I've decided to offer a bounty. What I'm most interested in knowing is if my scenario in the ETA1 below is viable and is used. If it isn't, then a good explanation of why not would be a good answer. Another good answer would be an alternative (but not including the internalsvisibleto attribute). T...

Problem with LicenseProvider UsageMode in .Net Winforms

In the GetLicense method of a LicenseProvider, there is a context that can be examined for a UsageMode. This is either DesignTime or RunTime. I assumed that this would behave exactly like a control's DesignMode property but it doesn't appear to. I've implemented my own LicenseProvider and, as a test, I display the UsageMode everytime t...

TextBox control limits lines to 1024 characters regardless of WordWrap setting. How to increase?

The TextBox control (in a .NET winforms application) seems to hard limit line lengths to 1024 characters, even with the WordWrap property set to false. Is there a way override this? I need to view lengthy data in a visual sense. Currently a line of 2000 characters wraps onto the second line and causes the right edge of several lines to ...

Docking controls on MDI Parent Form

Hello.. I would like to create a MDI Form that has a Treeview on the left side of the form. I would like to be able to open child forms within in this form. The child forms should be able to move around in the right side of the form but not move over the tree view on the left. Basically I want a parent form and want to be able to defi...

Is it possible to make a PropertyGrid property ReadOnly unless edited with a custom dialog?

I have a PropertyGrid whose SelectedObject value points to a class with several members like this one: [Editor(typeof(OutputFormatTypeEditor), typeof(UITypeEditor)), ReadOnly(true)] public String OutputFormat { get; set; } With ReadOnly set to true, the user cannot touch the property, even when it is being edited with the OutputFormat...

Is it possible to disable context menu items based on the selection on Treeview

I will have some sort of nodes for a treeview as follows Root |-> some.txt(A text file which was added at runtime) |->Child(child for some.txt) |-> child1(child for child) I designed my context menu with some options as New and Remove What i need is when i righclick on Root, child or child i would like to disable the Remove op...

Disable conversion of & to shortcut indicator (winforms)

I have a tab control (in my case a UltraTabControl from Infragistics) and I add a new tab. The text of this new tab is set to "Escape &Characters". lTab.Text = "Escape &Characters" When visualizing the tab control the & will become an _ (underscore) for the next character - in this case "C" I know that & is the Microsoft way of ind...

Cross-thread calls to WF controls

Hello. I am work with SharpPcap library. I have following code: private void button1_Click(object sender, EventArgs e) { LivePcapDevice device = deviceList[cbDeviceList.SelectedIndex]; device.OnPacketArrival += new PacketArrivalEventHandler(device_OnPacketArrival); device.Open(DeviceMode.Promiscuous, 1000); ...

Add dynamically loaded WindowsForms control to a WPF WindowsFormsHost

I have a WPF project where I load a WindowsForsm assembly (dll file) dynamically like this: Assembly currentAssembly = Assembly.LoadFile(System.IO.Directory.GetCurrentDirectory() + @"\" + fileName); System.Windows.Forms.Control currentControl = (System.Windows.Forms.Control)currentAssembly.CreateInstance(feat...