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
2
votes
1answer
5k views

Restoring data from database to list with SQLite

I have a Winforms project in which I have a screen which loads a questionnaire. It restores answers the user has previously entered by restoring the saved results from the database to a single list (...
5
votes
1answer
3k views

Passive View implementation in c# MVP

I have a c# WinForms application in which I have tried to implement the Model View Presenter pattern with Passive View. The View derives from a parent IView which propagates the public members and ...
2
votes
1answer
123 views

Display a list of editable properties

I'm trying to create a grid of settings for the user to edit. I'm using a PropertyGrid at the moment, but I'm open to alternative solutions. My two big issues are ...
12
votes
3answers
5k views

C# OOP Pong game in WinForms

I want to learn C# and have started off with making simple Pong game. I would like to ask you whether the approach I took is correct, as in it is readable and fits the conventions/standards. Maybe ...
2
votes
1answer
568 views

Extension methods to save and load form size, position, and state

I wrote these extension methods to provide a generic/re-usable method for saving a form's size, position, and window state. What I would primarily like to know is if there is a better way to handle ...
2
votes
2answers
218 views

Checking a Model's function's return value and setting values to a View member

I have a WinForms project that uses the Passive View MVP pattern. In the Presenter of one of my Views I have a function that gets questions and from its Model. But I want to make sure these ...
2
votes
0answers
685 views

Handling a user control that needs to be put on my form in WinForms project using MVP pattern

in my application i have a form 'DetailScreenView' which implements 'IDetailScreenView'. It is connected to 'DetailScreenPresenter' by the Passive View MVP pattern. I also have a '...
3
votes
1answer
630 views

Handling an openFileDialog in the View of my MVP WinForms project

I have a WinForms project in which I am trying to implement the Passive View MVP pattern (meaning no business logic in my Views). Each form is a concrete View with an IView interface to which a ...
7
votes
3answers
11k views

Dynamically adding controls to a form in a WinForms project

I have created this function in my DetailsScreen.cs, but I have no idea if this is the correct file to put this kind of code in, or if coding it this way is the correct approach. I know that it works ...
3
votes
1answer
5k views

TabPage version of SelectedIndexChanged

I order to speed up opening of a file (which contents are displayed in a series of tabs), I made it so that tab content is generated only when the user first clicks on the tab. If user never opens the ...
6
votes
1answer
3k views

Localized Enum in C# 6

I had to jump through some hoops to get a localized enum working. I went through dozens of SO articles that never actually answered the relevant conundrum with a working solution. So I made my own: I ...
4
votes
0answers
868 views

Custom animated image control

I have written the following control which allows loading a GIF from embedded resource, file, or raw Image. It allows for more granular control over the direction ...
1
vote
2answers
702 views

Alternate checked between buttons

I'm trying to alternate if a button is checked. I've come up with this, which works but its feels unnecessary to write 70 lines of code for such a simple task. How would I go about to shorten this up,...
1
vote
1answer
397 views

Little copy tool

I made a little copy tool, but my progress bar seems to be too slow. I would also be very interested in any tips and improvements or code smells. MainForm (code ...
2
votes
0answers
246 views

C# Winforms MVP (avoiding circular dependencies)

I asked the following question on stackoverflow and as a result came up with the following code to avoid circular event logic when using winforms. There are two occasions where my model can be ...
2
votes
1answer
64 views

Avoiding code duplication for reading in similar values for each derived class

I am designing a program that handles many types of grooves TKY, VSingle under GrooveType. Each of this groove is paired with ...
0
votes
1answer
4k views

Setting a textbox value to zero if null

Is this the correct way to set value of textbox to zero when it's null? Is there any way I can improve the calculation that I am doing? ...
6
votes
2answers
113 views

Refactoring Calculations through a series of textboxes

Alright guys, I know this isn't the proper way of problem solving, But I need some guidance here. Since I am just starting in programming, the code is not really readable. The Winforms program (...
4
votes
1answer
162 views

Generating buttons efficiently

I've written a Minesweeper program, but my code for generating the buttons is taking much longer than I'd like. Here is the GUI code: ...
12
votes
5answers
7k views

Handling keyboard shortcuts in C# software

Edit: I have added the revised code in an answer to this question. Currently, I handle the keyboard shortcuts of my applications in a single huge method that looks like this: ...
9
votes
3answers
5k views

Converting string to control

I have an up-down numeric control on my form (attEdgeUpDown), which has value 0-8. I have eight checkboxes (attEdgeBox1 to ...
3
votes
3answers
1k views

Divide decimal by range of fractions, and then convert the fraction that is closest to a whole number to a mixed fraction

My program will divide the decimal (\$30.0575\$) by a range of fractions (\$\frac{1}{1}, \frac{1}{2}, \frac{1}{4}, \dots, \frac{1}{48})\$ leaving me with list of improper fractions that look like this:...
26
votes
1answer
60k views

Use of Async/Await for EventHandlers

I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. ...
15
votes
2answers
10k views

Guitar Hero III Bot

I made a Guitar Hero III bot for PC. I was able to beat the song "Through the Fire and Flames" on Expert with the bot which can you see here. If you watched the video, you can see that the bot misses ...
5
votes
1answer
1k views

Reactive Properties for easy property binding

This is my attempt to write a data-bindable, platform independent property that doesn't require any literal strings. The basic idea is to basically have the same functionality as IObservable, but with ...
4
votes
1answer
145 views

PDF conversion and time stamp tool

This is the latest edition of my PDF tool, previously mentioned here, here, here, and inspired by my first attempt at a MVP here. Major differences from previous editions: It uses the MVP pattern (...
5
votes
1answer
3k views

Model-View-Presenter Winforms app

This is my first attempt at a Model-View-Presenter pattern Winforms application. The model is a class that stores a bunch of primitives, and the view is a ...
5
votes
3answers
608 views

PDF script tool to convert documents to PDF and add fields and scripts

This is an update from here. This tool is a Windows Form application that can add fields and scripts to PDF files, as well as convert Microsoft Office Word documents to PDF. The usage is as follows: ...
6
votes
1answer
307 views

PDF Script Tool - adds JavaScripts to PDF files

This is a Windows Forms application that adds JavaScripts to PDF files. It supports multiple files at the same time. Right now, the only supported script is a "time-stamp on print" script, but any ...
3
votes
1answer
900 views

Active Directory Query Application - Take 2

This is an update to my previous post about my Active Directory Query Application. I have made multiple modifications, and I request some feedback. Summary: This program queries an active directory ...
4
votes
2answers
450 views

User editable properties with varying number of arguments

Recently I used this pattern to create a list of properties, each property having a varying number of arguments. The properties list can be made at compile time, it does not need to change at ...
3
votes
2answers
540 views

Active Directory Query Application

This application is designed to query an active directory, and at the moment, performs only two tasks: Save a list of all users to a file. Save a list of all groups that all users are in to a file. ...
1
vote
1answer
5k views

Improving GUI update call from a worker thread in winforms

I have a winforms app and I've been using the following approach to update controls on the main form from worker threads: GamepadManager class has: ...
3
votes
1answer
117 views

Arranging Buttons on a Process Enumerating Application

I had the following piece of code for populating a list of currently running processes in an IT Self-Help application : ...
3
votes
1answer
2k views

Chess game in Windows Forms Part #2

(Part 1 here) I've recently created my own 2-player chess game, no AI... at least for now. I do plan to do that in the future, so one of my concerns is if the code is flexible enough to just use the ...
9
votes
2answers
16k views

Chess game in Windows Forms Part #1

I've recently created my own 2-player chess game, no AI... at least for now. I do plan to do that in the future, so one of my concerns is if the code is flexible enough to just use the same classes in ...
5
votes
2answers
18k views

List<dynamic> to ComboBox

This code get a list<dynamic> from a repository class using Dapper. I need to bind this list to a ...
3
votes
1answer
610 views

Update and sum query C# Access DB

I have a simple query using query builder of VS2012 C# which updates the database in my winforms application. The database has 216 entries so far and it's taking a lifetime to update the database. How ...
1
vote
1answer
356 views

Design/Architecture for MVC WinForms Dialog Control/Use

All I have built an MVC WinForms application where Views are blind and deaf of their controllers. To facilitate this I have used Ninject as my Dependency Injection (DI) Inversion of Control (IoC) ...
5
votes
1answer
744 views

Tic Tac Toe using WinForms

I have made a simple tic tac toe game and need help tweaking it to fit the bill of object oriented design. Any suggestions most welcome. I basically want it safer, and more "best practice-like" It is ...
2
votes
0answers
85 views

Supporting all closure options in WinForms MVC application

I have a WinForms MVC application that uses Ninject for it's Dependency Injection (DI) / IoC Container. I have build quite a nice framework that allows the main shell (which uses a Docking Container ...
3
votes
2answers
117 views

Creating a new camera stream

I'm currently in the process of refactoring some code and I was wondering if I should use switch or if-else for the is code: ...
3
votes
2answers
324 views

Project Euler GUI for Problem #1 through #11

I've been working on the Project Euler problems, so I created a GUI and a Solver class for all the code I've been creating. I'd like to share it with you guys and to get general feedback on my coding ...
2
votes
0answers
61 views

UI code-behind for managing employees

I have a form code behind and it has what are called "Common Utilities". Basically the original author made a super class that is embedded into the main form code behind. What is the best way to ...
6
votes
2answers
4k views

C# Winform Amazon Application

This is my first program I've written ever. Don't hold back on me. Any help and feedback is appreciated. This code wont work because it requires some keys, but I censored them out, but it does ...
9
votes
2answers
1k views

WinForms Poker (complete project)

I have quite huge question/favor to ask but I hope I can get some useful answers. This is my first complete project, I'm still learning C#, my first programming language. I'm afraid that there will ...
3
votes
1answer
7k views

Use of Ninject as an IoC container in a WinForms MVC application

I am a relatively experienced WPF developer who has had good exposure to MVVM. I have been developing legacy WinForms applications for a while and have recently been asked to fully re-write a large ...
15
votes
1answer
674 views

Simple dictionary storing/viewing application

A TreeView on the left which just displays a list of files saved by the application. A DataGridViewon the right to display data ...
2
votes
2answers
2k views

Insert rows in the datagridview with a dictionary

I would like to improve the function below without calling twice InserisciRigaNote. Before I fill my dictionary. When I compare ...
4
votes
1answer
2k views

Disable and enable text boxes according to the radio button click

Here is a GPA calculator in C#. I am feeling like the code that I write and format are quite long and would like it to be shorter. This program is using radio buttons to enable and disable the text ...

1 2
3
4 5
7