winforms

True disable of a check box in a DataGridView using DataGridViewCheckboxCell

Does anyone know of a way to disable a checkbox in a DataGridView using a DataGridViewCheckboxCell? I can make it read only, and set the background color, but I can’t get the checkbox itself to appear disabled. Any thoughts? ...

MS Chart Control Zoom MinSize issue

I'm implementing a scatter plot using the MS Chart Control .NET 3.5, WinForms, C#. My x-axis data is DateTime and noticed I couldn't zoom in smaller than a resolution of 1 day, despite setting the ScaleView as follows: chart1.ChartAreas["MyChart"].AxisX.ScaleView.MinSize = 4; chart1.ChartAreas["MyChart"].AxisX.ScaleView.MinSizeType = D...

C# DataGridView, large cells: Content never fully visible, scrolling skips cell

I have encountered a rather nasty problem with the DataGridView control (Windows.Forms, .NET Framework 3.0) when there is a DataGridViewCell that is larger than the DataGridView itself. When the large cell is scrolled into view it displays normally, cut off at the bottom since it is larger than the view. If you scroll down further it eve...

How to set DataGridViewColumn data Type at RunTime based on the cell's value?

I have a Winforms app that has a DataGridView that is databound at runtime. One of the columns contains mostly just text but some of it's cells are populated with url's that I would like to make clickable. How can I can I tell the DataGridView that if the value in the cell looks like a valid url ie. begins with "http" or something simi...

Windows form from console

Hello. I would like to spawn a Windows form from the console using C#. Roughly like display does in Linux, and modify its contents, etc. Is that possible? ...

C# - How to deal with 2 "TopMost" Forms?

I have a parent form that is set to be TopMost and then I have another form that opens when a button is clicked. This child form is also set to be TopMost. The first issue I had was that when I opened the child form, the application would basically freeze because you couldn't access anything. I decided that instead of using ShowDialog...

Fix embedded resources for generic UserControl

During a refactoring, I added a generic type parameter to MyControl, a class derived from UserControl. So my class is now MyControl<T>. Now I get an error at runtime stating that the embedded resource file MyControl`1.resources cannot be found. A quick look with reflector shows that the resource file is actually called MyControl.resourc...

Windows Forms: create the main application after login, which form to run?

Using Windows Forms I would like to have a small login screen the user authorizes himself/herself through (say its Form1), so the main application (say its Form2) would be opened after login. But I suppose when I use Application.Run(Form1), after closing it the whole application closes. Isn't there any other way except using invisible ...

MessageBox.Show()

I would like to Show my Messagebox in the center of its parent form. if i move the form and show the messagebox, it always show in the center of the desktop. i want it to appear along with the form. Can you give me some tricks and advice? ...

Listbox selected event firing automatically?

Hi, I've a winform and I'm trying to bind some elements at page load method. After that listBox1_SelectedIndexChanged event fires automatically. Why it is happening? Thanks in advance, Nagu ...

How to port BrowseForFolder from VBScript to C#/WPF?

I need some kind of dialog for browsing the local SMB network for file shares. VBScript does it like this. Set application = CreateObject("Shell.Application") Set folder = application.BrowseForFolder(0, "Moo!", &h250, &h12) ' &h12 sets ' Network as the root folder. So I added a reference to Forms and tried to do it with FolderBrowserD...

C# WinForms DataGridView background color rendering too slow

Hi ! I'm painting my rows in a DataGridView like this: private void AdjustColors() { foreach (DataGridViewRow row in aufgabenDataGridView.Rows) { AufgabeStatus status = (AufgabeStatus)Enum.Parse(typeof(AufgabeStatus), (string)row.Cells["StatusColumn"].Value); switch (status) ...

.Net DataGridView "Index 0 does not have a value."

I am having trouble with a DataGridView. I have a collection of 3 Items bound to the grid, when trying to delete one of the items and reload the grid. If have code of If (dlg.ShowDialog() = DialogResult.OK) Then 'Show dialog with grid on it End If On the opened dialog, I delete an item from the grid (which should in turn, delete...

How do I find which control is focused?

I have a .net MDI application written in vb.net. I'm trying to program a form that will allow the user to select a special character such as °, µ, ², ³, ɑ and so on and have that character inserted into whatever control was focused prior to their launching the form via a hot-key or the main menu in the MDI parent. The easy way to do th...

How to get the Form.DesktopBounds from before the window was minimized or maximized

I would like to save and restore the state of a WinForms Form, more specifically the DesktopBounds and the WindowState. However, when the WindowState is not normal (i.e. minimized or maximized) then I would like to save the previous value of DesktopBounds, when the Form was still in a normal state. Obviously, windows remembers this pr...

Get display value from combobox in radgridview

Hi, I am using Telerik's RadGridView to display some data. One of the columns in this gridview is a combobox, which is populated like so: DataTable dtContractorName = A133DB.GetContractorsForCombo(true); GridViewComboBoxColumn contractorNameColumn = new GridViewComboBoxColumn(); contractorNameColumn.UniqueName = "ContractorID"; contra...

SecurityException: That assembly does not allow partially trusted callers

From a C# WinForm project, I want to call a .NET COM method that already exist. I've added the reference to the COM, but I can't get rid of the SecurityException "That assembly does not allow partially trusted callers". Both projects are strongly named. I've added [assembly: AllowPartiallyTrustedCallers] at the top of the COM project, b...

C# Why Accesing ListBox.SelectedItem.ToString(), the form tries to dispose?

Hey Guys. I'm developing a small POS for a university proyect. I have a form who acts as a POS main window, with a datagrid and so on. Also, i have one form who is the Sensitive search or Incremental search, and i want that form to, select one item in a listbox and return it to the main window. Now i have a property in the main wich gets...

How to control Column Type in DataGridView that is bound to a CustomObject?

I have a DataGridView in a C# WinForms app that is DataBound at runtime (through Form_Load) to a custom Object. In the design view of the DataGridView I have no columns set up. When the Form loads the the columns are automatically created based on the data in the Custom object that it is DataBound to. My question is how can I control the...

How to set custom properties on a Winforms control bindable?

I have some properties like OverlayColor, etc that I want to bind to an instance of a different type, but the bound data just doesn't change. I use this: [Bindable ( true )] public Color OverlayColor { get; set; } The UI changes but not the bound data. Bound data's property name is Color. ...