winforms

Open a form with Form.Show: The first mouse click is ignored. Winforms, .Net

Using the code below: Private Sub ShowDropDown() Using f As New DropDownForm f.Visible = True Do While f.Visible Application.DoEvents() // Call to not take up 100% resources Loop End Using End Sub If the ShowDropDown method is called by anything other than a button click, then th...

Using aero theme in Winforms like we do in WPF

Hi. I know how to use the Aero theme in my wpf applications when running in Windows XP.Link Is there any way to do the same in a Winforms application? Thanks. ...

A good collection to use when binding to a DataGridView in C#.

What would be the best collection to use when binding a list of data to a DataGridview in C#? I'm currently using just a Generic List but the data grid doesn't update when there is objects added or removed from the list. I've looked at using a BindingList or a ObservableCollection, but can't decide which would be best to use that would...

Minimize/Restore with hidden caption bar makes windows forms window grow

I hit this problem in Windows Forms, after using PInvoke of SetWindowLongPtr to remove the caption (WS_CAPTION) from a Sizable window. After that whenever the window is either Minimized or Maximized and then restored to Normal it grows (by the CaptionHeight + border). It appears that Windows Forms' layout mechanism is trying to compens...

How to create a popup menu in visual basic.net?

How can I create a popup menu in vb 2008 for use as a context sensitive menu for when I right-click? ...

Dynamically render a DataTable into a Winform using the SSRS ReportViewer Control

BACKGROUND I'm writing a method that will (eventually) take as input a System.Data.DataTable and render it as an (simple,tabular) SSRS report into a Winform using the Microsoft's ReportViewer Control (http://www.gotreportviewer.com/) In order to do this I need to (1) dynamically create an RDL file based on the DataTable (2) load the RD...

Tooltip not displaying, flashes when control is clicked

I have a check box that is disabled that should be showing a tooltip when hovered over, but instead nothing happens. Once the checkbox is clicked on the tooltip shows momentarily then flashes on and off very fast. What could be causing this? The tooltip should also be showing for every control involved, but shows for some and not others ...

C# vertical tab

Hello smart people, Does someone know how can i implement a vertical tab in c#? Thanks ...

Visual Basic & Context Menu

Is there a way to add a Header to the popup menu? I don't find a property for this. ...

C#: Custom control is resizing on its own

I have a custom control built of other controls that is being loaded in two different places. On one it appears the way it does in the designer, as expected, on the other it is being resized smaller without being instructed to do so. Even when I explicitly adjust the size in code the control appears to get bigger, but the controls within...

Using a custom Button class instead of Forms.Button

I have create the class HoverButton which derives from Form.Button. Here I override the OnMouseEnter/OnMouseLeave events. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace DSLiteWizardLib { class HoverButton : Button { #region Constructor ...

Creating a progress bar that runs on another thread, while keeping calculation in main thread

Preface: I know this is an unusual/improper way to do this. I can do this with a "real" ShowDialog(), background worker/thread, and so on. I'm not looking for help doing it that way; I am trying to do specifically what I describe here, even if it is ugly. If this is impossible for X reason, please let me know though. I have created...

Automatic combo box in datagridview in .net

dim dt as new datatable dt.columns.Add("Check", Type.GetType("System.Boolean")) datagridview1.datasource = dt A boolean type datacolumn a datatable, when bound to a datagridview automatically shows as DataGridViewCheckBoxColumn. With no code hassles Inclusion of what type of datacolumn in the datatable will populate a DataGridViewCo...

Set ClientRectangle in custom form in C#

In C# I have custom form of None border style which override onPaint event and draw custom background with transparency key. I want to set my own client rectangle value (so content would be placed inside my custom border), but unfortunally Form's ClientRectangle property is read-only. I found advice over net to override WndProc method (w...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always displays System.Data.DataRowView or something like that.. EDIT: roblem was coused by this 2 lbList.DisplayMember = "hm"; lbList.ValueMem...

Why does .NET read values of unaffected properties on reception of INotifyPropertyChanged.PropertyChanged event?

Hi everyone! I'm new to data binding and encountered the following oddity today which I fail to understand: I have a form with two labels (labelA and labelB) and two buttons (buttonA and buttonB). The form hosts an object (called "formState") with two properties (CountA and CountB). labelA.Text is data-bound to formState.CountA, labelB...

Linqy no matchy.

Hi All Maybe it's something I'm doing wrong. I'm just learning Linq because I'm bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. usage: enter text into textbox, click button. program lets you select a file to match the textbox value against and returns matches ...

WinForms dialogs with TopMost = true

I have a dialog implemented in WinForms that is shown as a notify dialog on the bottom right of the screen. The problem is that whenever is shown it takes the focus and this happens only when TopMost = true. How can I solve this? ...

is there any rule about context menu nesting best practices . .

i started working on an app and when you right click on a grid, you get about 14 menu items. i thought it was cleaner to start to nest some of the menus as there were clean "grouping" of menu items but it caused a bit of debate. is there some guideline or best UI practice on context menus? ...

How do we solve all this "Conversion from type DBNull to type String is not valid" nastiness?

In our applications, I can't think of many cases where we care about null string fields. We just want them to show as empty strings in most situations. So when using the built in ADO.NET dataset / datatables, the error: Conversion from type DBNull to type String is not valid is all too common later on in the app when referring...