winforms

How to set the min/max distance for the Splitter control?

I want to set the minimum and maximum distance for the splitterdistance to move around... how to set that... i tried using panelMinSize it didnt worked... Actually in one of the panel of the splitter i have a control and the splitter should adjust based on the control.. ...

Why do WinForms WebBrowser events modify the page HTML behaviour?

I have a WinForms 2.0 WebBrowser control that shows some dynamic HTML page, and I need to use some custom context menu for that. In my page, I hove some links that execute javascript code, written with this markup: <a href="#" onclick="myCode(); return false;">Click here</a> Everything works fine, myCode() is called, and the href is...

Why the path is getting changed

Hi all i have doen a code to retrieve direcotry path in 2 different forms. If in one form if i select a path to open a file and finished and when coming back to the other form i am getting an error as Direcotry Exception. But i used to different strings to get that path like in my 2nd form i called this string strFilePath2; ...

Scalable WPF and Forms combined in one app.

Hi, I'm developing an app that is a mix of WPF and Forms. Some Forms are hosted in wpf host some in form host . What I want to do is to make my app scalable on resize. When user expand the form it should stay in the center when windows gets smaller it should scale with it. I did something like this protected override void OnResize(E...

.NET Listview Refresh

I have the following code, which basically takes values from a database and populates a listview. using (IDataReader reader = cmd.ExecuteReader()) { lvwMyList.Items.Clear(); while (reader.Read()) { ListViewItem lvi = lvwMyList.Items.Add(reader["Value1"].ToString()); lvi.SubItems.Add(reader...

How to create Object (label, button) using Code

How to create Object (label, button) using Code? ...

How to check if a userControl is in front of others in C#?

How do you check whether a userControl is in front of others? Is there easy way to do that? I use bringToFront method when my user control was clicked, but now I need to determine if it is in front at the moment. ...

Why i should call Control.Invoke from non-ui thread?

Why i should call Control.Invoke from non-ui thread? As i know any manipulations with control are the messages to control. So when i call, for example TextBox.Text = "text", it will produce message SendMessage(TextBox.Hanlde...). That message will be queued into UI thread message queue and dispatched by UI thread. Why i have to call invo...

stackoverflow exception in form class

When I try to create an object of the form class within the form class, it gives an exception as stackoverflow occured.However, when I declare the object of form class within a method,it works fine.the code is as follows: namespace WindowsFormsApplication6 { public partial class Form1 : Form { **Form1 f1 = new Form1(...

Arrow key events not arriving

Test project which exhibits the problem: http://mike-caron.com/Testbed.zip Basically, I have a form with a custom control on it (and nothing else). The custom control is completely empty, and the form has KeyPreview set to true. With this setup, I am not receiving any KeyDown events for any arrow keys or Tab. Every other key that I hav...

Conditional Delegate Question

Hi SO, Let's say I open a form and want to attach a command to it after it closes. FormZombie FormZombie = new FormZombie(); FormZombie.Show(); FormZombie.FormClose += delegate{Utilities.DoSomethingCool()}; How can I make Utilities.DoSomethingCool() trigger only executes depending on what happens in FormZombie? ...

cloning tabpage with user control inside of it?

There is a form with a tab control, which has a tab page element. This application is designed in such a way that it is if you drag and drop a chart control (which are listed as icons in a sidebar) the chart gets populated with data, and shows a graph. We have a button which should make a clone of that tabpage and show itself in another...

Composite DisplayMember for ComboBox

I need to display multiple pieces of data in a combobox, but I can't figure out how to do it. Here's the code I'm trying to make work: innerBox.DisplayMember = @"t => t.TenantName + ""\t"" + t.Property.PropertyName + ""\t"" + t.RentalUnit.UnitNumber "; But it doesn't work, this does though: innerBox.DisplayMember = @...

[WinForms] ToolTips style

Im looking for a library that can help me design ToolTips within WinForms. it does not have to be tooltips but an on hover / single click is ok. I need to show client information on the hover event and show a gui that can hold image and other information This image will describe exactly what im looking for! ...

Font color on hover for list items in a combobox

I have a combobox that has custom drawn items. It also makes use of zebra striping and because of this, the hover color is sometimes off. How can I control how it looks on hover? Here's the code I use: Color zeros = Color.FromArgb(200, 200, 200); Color ones = Color.FromArgb(225, 225, 255); private void innerBox_DrawItem(obje...

How can I get a class to "reset"?

I am writing a C#.NET application. I have a form. When the form is created I create an instance of a class. When I close the form, I want to dispose of the class so that the next time I open the form I can just create a fresh new instance of the class. So, in the form_Closing event I added code like this: classInstance = null; The proble...

Deploying a Solution with Visual Studio 2008

My current solution has a Windows form Application as well as a Service Host. My question is the current process for building and deploying both. The Service Host will be hosted on the machine on which it is built. The Windows Form Application should be deployed to a windows share location. If I right click the Windows Form applicati...

ComboBox.SelectedValue is messed up after binding to a List.

Hi guys, I am losing my senses here... I have ComboBox on the form with one property changed, Sorted = true. This property is messing up with SelectedValue and I would like to know why. take a look at the code(you can paste it to the new WinForms project and it will work after adding a combobox): private void Form1_Load(object se...

Windows Forms C++

I have just started to learn C++, and I would like to learn how to make Windows Forms C++ applications. Could anyone recommend some good ebooks? I have a small converter program that I have made. It runs from the console, but I would like to make a nice GUI for it. The form is quickly made in Visual Studio, but then I need to insert s...

Catching an Exception across treeview.Nodes.Add / treeview_AfterSelect event boundary

There is a place in my WinForms program that throws a MyOwnException. void CodeThatThrowsMyOwnException() { ... throw new MyOwnException("Deep Inside"); ... } Further up the stack, there is a simple try/catch block try { CodeThatThrowsMyOwnException(); } catch (MyOwnException moe) { MessageBox.Show("Hit this point...