winforms

Form_Load() 'event' or Override OnLoad()

I would like someone to try and explain the difference between these. More specifically, example usage scenario's. I am refactoring some Windows Form code and a Form has some code in the Form_Load() event and also in a protected override void OnLoad() event that calls base.OnLoad(e); Now I traced it and the Override fires first and ...

Cannot bind to the property or column [...] on the DataSource

I am trying to bind Font property of System.Windows.Forms.Label to a property of my class (via forms designer). This is the exception I am seeing "Cannot bind to the property or column HeaderText on the DataSource" I tried making my class static and make it expose static properties - it didn't help. The generated code looks like this...

Grouping Controls in Pairs vb.net windows.forms - Dynamic List in grid format

I have pairs of controls: immagebox + textbox = one pair. I want these to show up in a single column grid/tabular format. Each cell contains one image/text pair. I want this grid to scroll because the number of pairs is dynamic depending on a user selection. I suppose I will be adding these controls in code at runtime when the user m...

How can I show an object in multiple panels?

Hi, I was wondering how could I use a custom object in more than one panel. I made a panelModified object (extends from Panel) and want to place it in two normal panels, so when the object change its status, both panels display the updated information. In my case the "panelModified" is a panel with some Buttons and an embeded video in ...

Capturing an image on another form, how to maintain dpi with bitmaps

Hi, I am using the function below to capture an image on a different form. The captured image is then fed to an OCR app, in this instance tesseract. The issue that I am having is that when the image is copied to the bitmap the quality drops to 96dpi and I want to keep it either at 1 to 1 or at least 300 dpi and also scale it *2 as the...

Where does a user-control go when the visibility of it is set to false?

Curiosity is kicking out again. I've been using the user control .Visible and .Hide() method for a long time. So where does a user-control go when the visibility of it is set to false? ...

Smart client Winform vs MVVM + Prism

Hi, I am new to desktop applications, so please bare with me if this sounds very basic question. The question is, is Windows forms Simart Client is a legacy thing now? and to be replaced by Prism (and/or MVVM)? Should I bother to learn about Smart Client? Another question which might be related to is that what are the performance diffe...

How to make the particular row get selected in datagridview based on treeview selection

I will have a treenode with some nodes. I will have a datagridview on my form. Initially i will load some data in to the gridview. Now if i select a node at my trreview i would like to make a particular row as selected one. Suppose my treeview is as follows Root |-> Child |->Child1 If i select child i would like to make a correspondi...

C# program exception

An exception occured. Exception is specified cast is not valid int s = (int)comboBox1.SelectedItem; ...

How do I catch KeyUp event ? (sample of code, please)

Hello guys, I need to catch KeyDown & especially KeyUp events for 1,2,3,4,5,6,7,8,9 keyboard buttons. How does it do ? I can catch KeyDown event but what about KeyUp ? Please, provide some simple code. .net 2.0, winforms (not wpf) ...

Programmatically changing the destination printer for a WinForms WebBrowser control

I'm trying to use an invisible WebBrowser control to print a very simple HTML document. Our application requires that we be able to print several documents this way, and that they all can be sent to different printers. Unfortunately, I haven't been very successful in making the output go to the right printer. The way it works right now...

Vertically aligning controls in a TableLayoutPanel

Is there any way to have textual content of controls on a TableLayoutPanel align themselves properly? I've got labels in column 0, and textboxes (or occasionally ComboBox or NumericUpDown controls) in column 1, but the text in the label is usually a pixel or two out (vertically) on most rows. ...

Control inheritance for consistent look and feel in a Windows Forms application

Hi, I am building a windows forms application where a very consistent look and feel across all modules is of very high priority. Apart from standard .NET controls it uses a lot of third party controls from different vendors. I would like to have the ability to change the entire look and feel of the application in one go, may be with up...

multi Auto Complete

I have connected a textbox to a autocompltecustomsource , is there any way to show list again when we insert ';' to list , something gmail do for 'To' textbox when you want to compose email . ...

TableAdapter Update fail

Hi everyone, I have a VB windows Form project that connects to several DataTables in an Access DB. On my form I have several textboxes, comboboxes and datetimepickers that are bound to those sources. With one table in particular when I try to update the tableadapter after editing one of the textboxes the update method fails. No exceptio...

Side By Side ClickOnce Installations

I would like to deploy a TEST version of my internal application to my testing group and I need it to install side by side with the current LIVE version. I changed everything in the Publish Options but it STILL overwrites my LIVE install. What else do I need to do? Do I have to change the Assembly Name on the Application Tab? Is tha...

How to develop login form C#.net

Please tell me how to build Windows form Login .(not ASP.net) . This login Should validate using not only windows Authentication method but also Database user. How validate User name and password. I used this type of Query for it SELECT COUNT(*) FROM [Table Name] WHERE UserName = @username AND Password = @password; If user avalable c...

I'm starting a new VB project and I could use some guidance...

Hi - I don't have a specific question here but I'm more looking for some guidance regarding a new software project I'm starting at work. Here is a description of the project: I am refactoring windows software that was written in Visual Basic 6 and uses MS SQL Server for a database. The code is tightly coupled with SQL queries and refe...

Display a C# message onlyonce

Hello, I would like to make a C# application that displays a message when the program starts up, with a button that says "Don't show this message again". When they click that button, how do I make it not display again the next time the program is ran. Any and all help would be greatly appreciated. Also, I'm unsure on how to show a me...

Excluding the GroupBoxes that are inside another GroupBox

Let's say I have 7 group boxes but some of them also have group box inside them and some do not. now if I want to iterate through those 7 group boxes and apply something to them, is there a way that I can exclude those Child group boxes from this loop? ...