winforms

Object of type "X" cannot be converted to object of type "X"

(Can't believe this hasn't already been asked, but I can't find a dup) In Visual Studio with lots of projects, when I first open the solution, I sometimes get the warning Object of type "X" cannot be converted to object of type "X". Generally rebuilding seems to make it go away, but does anyone know what this is caused by, and how to av...

problem with TextRenderer.MeasureText

Hi I am using TextRenderer.MeasureText() method to measure the text width for a given font. I use Arial Unicode MS font for measuring the width, which is a Unicode font containing characters for all languages. The method returns different widths on different servers. Both machines have Windows 2003, and .net 3.5 SP1 installed. Here is t...

how to import .xml file to database

hi i want to import my .xml file to sql server database in asp.net 3.5 c# for windows application.so give m rply as fast as posible. ...

WinForms StatusStrip Label and Progress Bar Not Visible When Spring is Set

I have a .Net 3.5 Winforms application that has a status strip at the bottom. The status strip contains two labels and a progress bar with the spring property set to true, the status strip layout is set to Table. But they are not showing up on Server 2008, but works fine on Server 2003, XP and Vista. Has anyone come across this? I ca...

How to custom format data in datagridview during databinding

I'm looking a way to format DataGridViewTextBoxColumn so that the value to be databinded is formatted during databind. For example I have a CompanyName property and I need to take first 5 letters from the CompanyName when databinding happens. I could hook on different DataGridView events (e.g. RowsAdded) and loop through all the rows an...

Remove need for Invoke() by handling within threaded library.

Within a class library I'm writing I have a method allowing the library to go and do some stuff on a different thread which does something like: public void DoStuffAsync(AP p) { this.Running = true; this.Cancel = false; ParameterizedThreadStart threadStart = new ParameterizedThreadStart(DoStuff); ...

Setting up Windows Form with C#

Any good resources for setting up a Windows Form with C#? Looking to create my first database application using C# and VS 2008. Thanks any advice is much appreciated. ...

DataBinding feedback in .NET2

I have a object myObject.Name in a Form1 with a textBox1 In the Form1_Load I do: this.TextBox1.DataBindings.Add("Text", myObject, "Name"); When validating the textBox I have myObject.Name changed. This is OK. Now I modify internally in myObject _name = "changed value", but myTextBox text will not change. so... how to do it on both di...

Default dialog padding

What should be the default value for a dialog padding? 8px 10px? ...

WinForms - MaskedTextBox - "variable-width" masking possible?

I need to create a WinForms textbox that allows decimal text exclusive-or integer text. Also, I don't wish to be required to specify the length of the text in the mask; the user should be able to enter as many characters as he wants, as long as the text fits the decimal or integer mold. However, the MaskedTextBox doesn't allow variable-l...

Is there an 'Application.DoEvents' at the form level?

I currently have an application that spawns multiple instances of a single win form. Each instance of the form has a timer which updates a number of controls and some of the properties of the form itself at rate of approx 1 tick/sec. Once the application reaches a certain number of forms it stops painting the 'updates' that occur withi...

Multiline Textbox Resizing in C#

Hello. I have two multiline textboxes separated within a splitContainer. When I drag the splitter left or right I would like the textboxes to resize accordingly. How do I do this? I am using Microsoft Visual C# 2008 Express Edition. Thanks. ...

Web browser control in Windows form

How does the web browser control in windows form work ? Any body has any idea. Is there an inbuilt internet explorer engine ? ...

How to offer application settings to an end user of your library, at design time, in .net, winforms

I have a library with with a set of classes with a common property that i'd like an end user to be able to override without overriding all the classes. The important thing is, the property has to be overriden at design time. Lets say, for simplicity's sake, that it's the background colour of a UITypeEditor. I can do this by putting the...

Is there something like master page in desktop aplications?

Hi everyone. Can I have master form that will contain windows forms? Or even windows control? Thanks a lot. ...

OwnerDraw ComboBox is not "styled" anymore

Hello, I've created a custom combobox with DrawMode = OwnerDrawVariable. Everything is fine, except it doesn't use visual styles anymore in DropDownList mode, i.e. it looks like old combobox. How can I make it drawn using visual styles? I checked VisualStyleElement class but haven't found there anything that could help me. Does it mean ...

Multiple User Controls referencing the same object.

Hi, I have created a UserControl in C# that I have put a DataGridView on. When I have only one instance of this UserControl in a WinForms project, it works like intended. When I have two instances of this UserControl in a WinForms project, the second instance of my UserControl behaves the way it should but the first one does not. It se...

How to get the application path at design time in winforms, .net?

If you use Application.StartupPath in a referenced dll, the path points to the path of the IDE. Is there anyway to get the path of the actual application? Just to be clear, this is at design time. ETA: I've posted the solution below: ETA2: Because it's related, I thought i'd post a snippet of another useful design-time service. Lik...

winforms concurrency question

Hi, What approach(es) would you recommend regarding a WinForms application that will have both the user interface & a scheduling components regarding sharing configuration data from the database? (exposed in the program via DataTable) Assume both the scheduled task and the user interface can make updates to the shared data. Also ass...

Winform .NET enhanced treeview?

What is a good TreeView replacement with added features over the standard one that comes with vs.net 2008? please include both a free and commercial options. ...