winforms

Basic questions about Classes, Modules and interaction

I am new to vb.net and very frustrated. Like all good programmers I want to split my code into separate files based on functionality . Some of my code interacts with users via Forms and some interacts with lab equipment behind the scenes (no direct user interaction). Sometimes a user will change something that will impact the lab equi...

.BMP Image colors being changed in winform application

I have some bitmap images being displayed in a DataGridView's and on custom controls. These are all basic lineart type images not pictures. I recently noticed that they all looked slightly faded/washed out and when I examined screenshots I took I discovered that any color channels that should have had values of 0 had a value of 44 inst...

Focus Lost event for a Winforms TextBox?

Which event should I use for this? ...

Better Practice: CheckBox DataBindings vs CheckedChanged event

I have a CheckBox that, when checked/unchecked will toggle the Enabled property of some other controls. I did have my code looking something like this: checkBox.CheckedChanged += new EventHandler((o, e) => { control1.Enabled = checkBox.Checked; control2.Enabled = checkBox.Checked; }); But today I started playing with DataBin...

How to instantiate a descendant UserControl?

Here is the scenario. I have a bunch of UserControls that all inherit from MyBaseControl. I would like to instantiate a UserControl based on its name. For instance: void foo(string NameOfControl) { MyBaseControl ctl = null; ctl = CreateObject(NameOfControl); // I am making stuff up here, ...

C#/.NET: Creating Dynamic Visuals in C#

NOTE: I am not exactly sure how to title or tag this question, so if you have any ideas, PLEASE help! I'm currently envisioning a few possible projects that involve dynamically rendering something (whether it is a point, a line, text, or music notes on a staff, for hypothetical example), but, if I were to undertake these projects, I'm n...

Windowservice error

I have solution which contain so many projects and windowservices. I modified coding on the application side of windowservice,after that i copied the exe regarding that service(F:\Components\Console\Bin\service.exe) in to the installation path(C:\Program Files\syscon\ Monitor\service.exe) after stopping windowservice from the 'service...

C#: How can I iterate through all checkboxes on a form

I have a form that has many dynamically generated checkboxes. At runtime, How can I iterate through each of them so I can get their value an IDs? Thanks, John ...

How to show non-interactive, auto-hiding notification popup message with Windows Forms in c#?

Using Windows Forms, .NET 3.5 framework, language: c# I would like to show a popup window for 1 second to notify users of actions that are performed. For example, when I copy a file X I want to show a notification like "Copied file X to File X-copy". Should be shown for a second, then autohide. ...

Visual Studio: Make view code default using attribute

I know how to configure VS 2008 to open windows forms controls in code instead of the designer. But I think I have seen a way I could do this with an attribute I could decorate the desired controls with. Does anyone know its name? This is especailly usefull if you want some controls to be opened in the designer and some in the c# code vi...

How to get Datagrid view cell value?

Using VB.NET How to get Datagridview cell value. I want to insert a Datagridcell value in the table, How to get datagridview cell value. Need vb.net code Help ...

how to programmatically change the background image on form c#

I need to change the background image of my form when i klick a button, and change it back to null again the second time it is clicked, how can i do this? ...

Is there a built-in way to replace the text of a link in a LinkLabel and have the other links automatically adjust so they stay on the same text?

In other words, if I have: var ll = new LinkLabel(); ll.Text = "Some links go here."; ll.Links.Add(0, 4); // Some ll.Links.Add(11, 2); // go Is there any method I can call to replace the text of the "Some" link with something else while keeping the "go" link the same. I only want to know if there is a built-in method. This is not h...

Custom table component in .net

How do I create a custom table in C#, where i'd be able to set up row titles? Is there a built-in component to do that? I'm currently migrating from Delphi, where there was a StringGrid component. So I wonder if there's such equivalent in .net. As for now, I've tried to play DataGridView, but as far as I understood, it lacks row heade...

Controlling horizontal scroll in RichTextBox

I have a RichTextBox that I'm spewing log information to, but the RichTextBox seems to want to horizontally scroll whenever text is appended that is too long to fit. After searching extensively, and repeatedly failing with ScrollToCaret(), it would seem that this function controls the vertical scroll position, but not the horizontal. I...

Is there a way to have properties for a Winforms control that behave differently at design time (in VS designer)?

I am looking for a way for some controls to have Anchor = Top, Bottom, Left, Right at design time so they would change when I scale the parent form. But doesn't do this at runtime when the parent form is scaled. Is there something like this? ...

.Net combobox with data values from one database & value saved in another

I have one table INVOICEDETAILS that contains a PRODUCTID among other things. I want to create a combobox that gets all possible PRODUCTID values from the INVENTORY table but save the selected value to the INVOICEDETAILS table. I can fill in the combobox with the INVENTORY values via the DATASOURCE property, but what I can't figure out...

Setting ShowInTaskBar = False, causes flicker when closing modeless form in .net, winforms

To recreate this behaviour, you need to create a pop-up form with the following properties: (1) ShowInTaskBar = False (2) Display the form with the Show method and loop until the form is not Visible. (3) In order to close the form when the mouse is clicked out of it, override OnDeactivate, and set visible to False. Next, create anoth...

MVC framework for WinForm application (MVC#, PureMVC)

Hi! I'm wondering which framework i should go for. As in the title, after some time of googling it seems that last battle will be between PureMVC and MVC#. For clarification my requirements are: open source free for commercial use lightweight easy to learn (I don't want to spend a lot of time trying to figure it out, no time for that)...

WinForm Controls binding to a List<T> problem

Hi, i have a List for storing my data, i try to bind its items to grid,listbox,textbox etc. but cant make it work well. Here is my code class Survey { public int Id { get; set; } public string Desc{ get; set; } public List<string> Choices { get; set; } } . List<Survey> _surveyList = GetList(); BindingSource _bindingSourceSur...