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
76 votes
8 answers
224k views

Getting/setting default values from my App.config

Imagine that I need a color palette for my Winforms application to have a consistent look. What I did was create a static helper class and helper methods that I can call from anywhere in my code, and ...
user avatar
38 votes
4 answers
7k views

"How are you spending your time on the computer?"

I've made a Windows Forms application to track all of the processes running on my machine and it also saves the time an application is "active", an active application is the one that is on focus ...
user avatar
  • 8,418
26 votes
1 answer
63k views

Use of Async/Await for EventHandlers

I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. ...
user avatar
24 votes
5 answers
3k views

Console window to debug Windows Applications

Since I was having some difficulties to debug the next step for Scrolly - A (very) simple infinite mouse "scroll", I've decided to make a console-like class that allows to add messages to it. This ...
user avatar
21 votes
3 answers
16k views

Determining if a connection has been made to a communications device

I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, but there is a nagging doubt I am ...
user avatar
  • 343
20 votes
5 answers
4k views

House plan design (Head First C#)

I've been working through the book Head First C# and this is an exercise from chapter 7, which is about interfaces and abstract classes. Note that the class design was mandated by the authors, I'm ...
user avatar
  • 20.3k
19 votes
6 answers
10k views

Login form C# SQL

Basically this is my first login form. I am using SQL and C# WinForms. I made user roles such as "Admin" and others and the user is taken to a specific WinForms, according to his appointed role (...
user avatar
  • 191
19 votes
2 answers
95k 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 ...
user avatar
  • 1,733
19 votes
3 answers
575 views

“How are you spending your time on the computer?” Part 2

In my previous question I got some pretty good suggestions which really improved the overall performance of the controls, but I decided to extend the application and add some more features : You can ...
user avatar
  • 8,418
17 votes
5 answers
2k views

Populating a ListView with Items

I populate a ListView with Items. Each Item has data attached to its .Tag property. Over time, I have needed to handle many cases where something would be null or ...
user avatar
  • 273
16 votes
4 answers
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. ...
user avatar
  • 291
16 votes
2 answers
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,...
user avatar
  • 163
15 votes
2 answers
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 ...
user avatar
  • 1,484
15 votes
1 answer
682 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 ...
user avatar
  • 503
14 votes
5 answers
78k 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 ...
user avatar
  • 423
14 votes
6 answers
1k views

Form to create new students or view existing student information

I started out with the best of intentions, but this form got hacky real fast. It's purpose is to serve as a create new Student form. Also, if you want to view an existing Students information. Think ...
user avatar
14 votes
2 answers
814 views

Input validation for a user

I have a small Person Domain Model as follows: ...
user avatar
  • 475
14 votes
4 answers
429 views

Rolling my own Configuration with UI

The Rubberduck Saga continues as I find a need to roll my own configuration. Since the program is really a *.dll and available to several host applications, using app.config is not an option. I ...
user avatar
  • 30.7k
13 votes
3 answers
5k views

Winforms Circular Checkbox

So here is my next creation, a circular checkbox. This is my third custom control, so I'm still learning, but have the basics just about down. Tips and suggestions are most appreciated: ...
user avatar
  • 643
13 votes
1 answer
37k 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 ...
user avatar
  • 133
13 votes
3 answers
173 views

Reordering method parameters

Next release of Rubberduck (should be 1.4) introduces a reorder parameters refactoring, which lets user reorder the parameters of a module (or class) member, and automatically adjust all usages. ...
user avatar
13 votes
2 answers
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 ...
user avatar
12 votes
5 answers
8k 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: ...
user avatar
12 votes
3 answers
14k 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 ...
user avatar
  • 121
12 votes
3 answers
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 ...
user avatar
  • 123
12 votes
2 answers
9k views

2D Collision Detection

I wrote this a while ago but wanted to see if I went about it the right way and if my brain is working correctly. I was thinking about these two projects the other day and I recently released the ...
user avatar
  • 315
12 votes
2 answers
2k views

Counting Calories

I have this program for counting calories. There isn't a whole lot to it yet. It's a moderately sized project, so I'll do my best to make it as short as possible, posting only the main of the program ...
user avatar
12 votes
2 answers
248 views

Exploring the code of the Code Explorer

The Code Explorer is a dockable toolwindow that displays a TreeView that shows all opened VBA projects and their respective modules, but unlike the "native" Project Explorer, Rubberduck's explorer ...
user avatar
12 votes
1 answer
156 views

Rubberduck "GoTo Anything" Navigation

The next version of rubberduck is going to include a pretty nifty "goto anything" / find symbol navigation tool that lets the user enter an identifier name in a combobox: UI To achieve the ...
user avatar
12 votes
1 answer
601 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 ...
user avatar
11 votes
3 answers
359 views

FizzBuzz in accordance with standards

I wrote FizzBuzz. My aim is to use C# Code Standards correctly, and write flexible code. How can I improve my solution according to code standards? How can it be better in general? ...
user avatar
  • 111
11 votes
3 answers
2k views

Scrolly - A (very) simple infinite mouse "scroll"

Out of fun, and to practice my rusty C# skills, I've made a very basic program. It only has 1 function: When you move the mouse to a side of the screen, it shown on the other side. Like an infinite ...
user avatar
11 votes
2 answers
7k views

Clearing all controls

I'm clearing all the controls on a windows form with the following ...
user avatar
11 votes
1 answer
166 views

Pattern-finding game

This is a game that is supposed to be based on strategy and guessing. The letters need to match in a ABCD fashion on each button on buttons[0] - ...
user avatar
  • 399
11 votes
1 answer
376 views

Refactoring my Todo List was on my Todo List. How's my MVC?

This is a follow up to Rolling my own Configuration with UI. I got a lot of great advice about the Configuration system I created, but no one touched on how all of my logic for the UI was in the code ...
user avatar
  • 30.7k
11 votes
1 answer
912 views

Approach to programmatically building hierarchical GUI components

At work I am developing an application using hand-coded Swing, and I've found that I have an easier time reading, writing, and maintaining hierarchical component creation using code blocks like: <...
user avatar
10 votes
2 answers
833 views

Calculate subtotals and totals from a form with many decimal values

I've got 17 currency fields on a form and need to do some calculations with their values. I wrote this method some time ago and have come back to try and refactor it to make it more efficient and/or ...
user avatar
10 votes
2 answers
163 views

TestExplorerWindow, the event-tossing UI

Following up on Integrating Unit Testing functionality into an old COM-based IDE, I made quite a few changes to the UI, and now the code-behind for my ...
user avatar
9 votes
3 answers
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 ...
user avatar
  • 101
9 votes
2 answers
353 views

short or simple solution for putting values from label to column in excel

I have a code here that counts the number of fruits from Column B to Column AF (31 days). I used a switch with cases from 1 to 31. I'd like my code to be simpler. ...
user avatar
  • 191
9 votes
2 answers
2k 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 ...
user avatar
  • 8,418
9 votes
2 answers
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 ...
user avatar
  • 8,418
9 votes
1 answer
2k views

MVP Passive-View

First of all, I'm really new to the MVP design pattern (Passive-View) and I've been trying to implement it in a WinForms application. Before I'm going any further, I'd be very happy if you guys can ...
user avatar
  • 93
9 votes
1 answer
1k views

Sorting Visualizations - WinForms

Description I think many many people have seen this youtube video "15 Sorting Algorithms in 6 Minutes" When I saw it, I decided: "I can do that better" and I tried to get things done with the tools ...
user avatar
  • 25k
8 votes
3 answers
943 views

Car generation algorithm

I have an algorithm which generates some cars (quote unquote) and displays them using Graphics. I would like to know if my code is using Random correctly, and if it has any memory leaks. Or if there ...
user avatar
  • 371
8 votes
3 answers
1k views

Dataset with optional addition to where statement

I am trying to generate a dataset from a query that has a where statement. If the user passes a value additional things need to be added to the ...
user avatar
8 votes
2 answers
1k views

ROT13 encoder/decoder

This is a simple utility, intended to sit on the desktop for when needed, that does the simple ROT13 encoding and decoding. I am used to coding in VBA, and I am interested in more .Net idiomatic ...
user avatar
  • 2,336
8 votes
2 answers
5k views

Banking application for practice

A few weeks ago I have started to teach myself C# and just finished my first little project, a very basic banking application. I don't expect it to be good but would like to get feedback (no matter ...
user avatar
  • 81
8 votes
2 answers
694 views

WinForm Logon Best Practices

I have a working logon for a WinForms Project. I use the program.cs file to launch the login form. I am not so sure there isn't a better way of implementing this. ...
user avatar
  • 475
8 votes
1 answer
735 views

Winform, with a workaround to avoid dependencies

I'm working on a Winform project. We currently have a modular design (shown in the image) in our project. Where on every user action (button clicked or selection changed etc), first we set the Model ...
user avatar
  • 195

1
2 3 4 5
7