We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [winforms]

WinForms is the informal term given to the graphical application programming interface (API) included as a part of Microsoft's .NET Framework, providing access to the native Microsoft Windows interface elements by wrapping the existing Windows API in managed code.

Filter by
Sorted by
Tagged with
5
votes
1answer
2k views

PowerShell Active Directory Browser

I've just published ADExploder. It's a single-script PowerShell app (source) that uses classic Windows Forms and the Directory Services API to be able to browse nodes and properties of Active ...
4
votes
3answers
1k views

Validating a string under few conditions

Following code validates NIC number of a person (National Identity Card, no like SSN) Requirements are... Length should be 10 digits or characters All should be digits except the last one Last one ...
2
votes
1answer
720 views

Using a single validation handler for all controllers in a form

In input validation I'm using this validation method in my all Forms. Here I have a single handler for all TextBoxes in my Form and if I have other controllers like ...
5
votes
6answers
118k views

Input validation for text boxes in a Form

In a Win Form I'm doing initial validation in the Form. So before saving data, I want to validate whether all the required fields are filled (Text Boxes) by the user. There are about 18 such Text ...
2
votes
1answer
327 views

Calling a copy constructor in Presenter to prepare a list of Models

I'm new to MVP. In a presenter I have following code. Here what am I trying is to create a list of Model objects (in this case ...
1
vote
1answer
430 views

Controlling permissions in a MVP application

In a Windows forms payroll application employing MVP pattern (for a small scale client) I'm planing user permission handling as follows (permission based) as ...
2
votes
1answer
3k views

Keeping WebBrowser control's DocumentCompleted event handlers

This morning, being in urgent need of an effective subject code solution, I have had to write a "quick & dirty" custom one: ...
11
votes
3answers
13k views

Pizza form project

I've just recently started C# and I was wondering if there's anything I can improve on. My project is a pizza form, where people can order pizza and the price gets updated, depending on whether they ...
6
votes
2answers
417 views

Message estimator

I'm new to C# and OOP and am struggling to move away from the procedural way of doing things. I understand the tutorials I have looked at but find it more difficult when actually doing something a ...
1
vote
1answer
666 views

Using Models and Entities in MVP pattern

I'm a beginner in MVP design pattern and In a MVP triad, I have Model - AdvanceInfo View - AdvanceForm Presenter - ...
4
votes
2answers
235 views

Using built-in type Decimal or Entity type Advance, to hold AdvanceAmount

In a wage processing system which employees MVP pattern We have Model classes WageInfo, EarningInfo, ...
2
votes
3answers
3k views

Employee wage/salary calculation MVP solution

In this project (C# Win forms) I'm supposed to calculate wages of employees. These are the steps: Calculate earnings from Attendance data. Here all regular earnings like ...
5
votes
1answer
2k views

Calculating Earnings from attendance details

In a C# win forms payroll application I need to calculate employee salary based on their attendance. I've written a stored procedure which calculates earnings of all employees from the data available ...
4
votes
1answer
4k views

Populating a Data Grid View in MVP

I'm developing a win forms application in MVP pattern. In the application, there is a small module to show the branch offices (called points) where the attendance entering process has been completed. ...
5
votes
2answers
189 views

Keep asking the user [after performing an action] until they wish to stop

I have a form that requires the user to select photos to be included in their portfolio before they can proceed to use the app for the first time. I don't want to spend the rest of my life ...
2
votes
2answers
956 views

MVP Pattern used in a payroll solution

I'm using MVP pattern for a payroll system as my final year project. There are about 16 entity classes (like employee, client, <...
18
votes
2answers
93k views

Displaying data from a database onto a form

I'm a beginner to .NET and could you guide me to right direction. My problem is based on the following code. Here I have 4 variations of same method and all 4 variations are working fine. What is the ...
3
votes
2answers
3k views

WinForm plugin architecture

I have been developing this plugin architecture, mostly for fun and education, its a simple WinForm with some plugin logic and two plugins, i want to know if there is a better way of doing it. Form1....
6
votes
2answers
4k views

Can calculation of word wrapping be made notably faster?

I need to re-wrap a text so that it fits a given width, font and DC. The result needs to be an array of lines. I use the following code: ...
10
votes
1answer
554 views

Password Manager UI: Populating DataGridView is Painfully Slow

I'm designing a small account/password manager using C# and SQL Server CE. LINQ to SQL is my ORM of choice. Here's the data model representing how the SQL Server CE database is set up: And here's my ...
12
votes
1answer
31k views

Small C# Pong game

I recently made a 140-lined Pong game in C# using forms. Since I'm very new to programming, I'd like if somebody would please read it and give me advice on where to improve, what you believe I did ...
3
votes
4answers
4k views

Handle multiple menu click events in one Sub

I have multiple menus that will change languages in one Sub that will handle multiple events of the menus click, It is working for me right now, I'm just wondering if there is better way to do it... I'...
7
votes
1answer
2k views

Fastest image upload into SQL database

I am trying to upload an image (screenshot from desktop) to an SQL database as fast as possible. I would like to optimize my current procedure in terms of speed: ...
6
votes
3answers
19k views

Chaining Tasks with async/await [closed]

I've been trying to learn how to use the TPL for quite some time now. Basically I'm trying to fire off a group of Tasks, wait for them to complete and then fire off another group of tasks, waiting for ...
1
vote
1answer
3k views

Winforms Enhanced ListView Class

Here is an "enhanced" Listview class. You can just add it your project and you're good to go. Most of the code came from here and there. It's not perfect by any means, so any input is appreciated. <...
3
votes
1answer
777 views

Naive implementation of attached properties for WinForms

I need to implement something like "attached properties" from WPF that targets WinForms. What I came up with seems to work. Can you find any issues with it? The helper class and example are shown ...
15
votes
4answers
1k views

Is decoupling necessary for very small applications?

I threw together a small solution for my organization today for some basic data review and approval procedures. This particular application will likely not change or add functionality at any time. ...
12
votes
2answers
9k views

BackgroundWorker vs TPL ProgressBar Exercise

I wanted to fiddle around with the BackgroundWorker and Task classes, to see how I would implement a given task with these two ...
13
votes
5answers
67k views

Loading a combobox with an enum and binding to it

I have the following code to load an enumeration into a bound combo box, but am not quite happy with it. I would prefer to store the actual enum value in the ...
15
votes
2answers
6k views

Simple temperature converter

Below is my first attempt at programming a Celsius to Fahrenheit converter in C# winforms. I'm looking for tips and advice on improving my style and what I can do to make the code more efficent/proper,...
5
votes
1answer
4k views

Reading a certain pixels color from a window

I'm currently reading a certain pixels color from a process window like this: ...
2
votes
1answer
2k views

Executing method on a certain interval + offset

I would like to execute a certain method at a given interval. The reason why I can't use a timer + its event handler right away is because I want to add an offset to each tick (100ms in my example ...
4
votes
2answers
12k views

Winform that exports a datagrid to Excel

I've just created a winform that exports a datagrid to Excel. Originally the file was never shown, but I was asked to give the option. So I put in a checkbox and modified the code. Is my if/else ...
3
votes
3answers
1k views
0
votes
1answer
208 views

Searching for a better implementation to EnumBase

In a former question on SO I described a problem with a construct called 'EnumBase'. As I sad there, I am not involved when basic implementation happened. So I'm not sure why the thinks are a they ...
1
vote
4answers
3k views

Foreach statement for two OfType<>

How would I write a foreach statement that includes both of these statement together ...
1
vote
2answers
5k views

Multiple forms for accessing records in database

I have a main form for adding and deleting records and a button that opens a child form that displays records from an access database. Child form will have buttons for moving though the rows like ...
0
votes
1answer
2k views

Is it necessary to move OpenFileDialog code for opening the files and put it into a separate method?

I want to separate the code inside my Add button click event from the code in order to make my code looks more arranged. this is my code before these changes (i am ...
1
vote
1answer
181 views

Class design question

I have Winform application and I want to separate the button click event from the main form. My application has Add button which adds files into my Listbox and ...
5
votes
2answers
3k views

Generic Task Blocking Queue

A generic blocking queue has the following properties: It is thread-safe. It allows queuing and de-queuing of items of a certain type (T). If a de-queue operation is performed and the ...
1
vote
2answers
226 views

CRUD menu creation

I would like to re-write this C# code so it is easier to understand. Should I create a separate function to configure a menu item? Is there is some kind of using ...
3
votes
2answers
8k views

Windows form that generates invoices

I have a C# program that I would like to have reviewed. I am new to programming and want to know how it could be improved. It is a Windows Forms project that generates a PDF using the iTextSharp dll....
1
vote
1answer
2k views

selecting an item in a listbox to assign it as a temp variable - Review Code

I got this answer here: https://stackoverflow.com/questions/15902299/selecting-an-item-in-a-listbox-to-assign-it-as-a-temp-variable Suppose you have loaded the ...
-1
votes
2answers
25k views

Insert to datagridview when SELECT query has WHERE condition [closed]

I use this code to Load and Insert data to a table using a DataGridView in a C# windows application. ...
3
votes
1answer
7k views

'Universal' WinForms TextBox Text 'Two-Way' Binder

Below is the code of a custom C# class I have called UniversalTextBoxTextBinder. I'm interested to hear the code review comments to find out the limitations of this 'universal' solution as well as to ...
1
vote
2answers
86 views

Get Set vs passing class at init?

I have the main form with a list inside and i need to open another form and edit the list in the main. Generally i'm doing something like ... ...
6
votes
5answers
31k views

Faster way of reading csv to grid

I have following in Windows Forms .NET 3.5 It works fine for csv with records less than 10,000 but is slower for records above 30,000. Input csv file can can any records between 1 - 1,00,000 records ...
7
votes
1answer
1k views

Is this code to hook into a .NET window that we don't own safe? Can it be made safe?

I have some code that is used to hook into third party code. It goes pretty much like below (mind you CodeWeDontHave can't be posted because we dont have the source). I have an issue where sometimes ...
5
votes
2answers
19k views

Timer Tick Event only to execute at specific time

I have a timer that is only supposed to tick between x and x on weekdays. I have used the following implementation. ...
3
votes
1answer
1k views

Automatic Databinding of controls to Model [closed]

I have developed a prototype framework (MVVM) where control on the form is bound to a model property using a naming convention and its UI behavior is controlled using custom attributes. As of now the ...