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
1
vote
0answers
131 views

News crawler for Google

This is one of my first "real" application using C#, so I'm probably doing a lot of things wrong. I made a simple news crawler, which uses Google to search for news articles of multiple companies. ...
3
votes
1answer
1k views

Cloning Windows Forms controls from a template

In a recent project I needed a way to clone windows forms controls from a template which had predefined Size, Font, etc. Since ...
2
votes
2answers
3k views

Is ThreadPool QueueUserWorkItem best option for handling event? [closed]

I have a WinForms application that has value change event coming from ble device. The event can be hit from more than one device also one device can send a notification to event in every 4 secs. ...
2
votes
2answers
1k views

Unit conversion application

I have a form with listboxes used for unit conversions. I'm using the UnitsNet package. Here are my questions: Is this the proper approach? If any changes must be made to this code, what are they? <...
1
vote
0answers
75 views

Merging/Chaining WebRequests

This code is used to login and check if the user has premium, and if so, add it to a ListView that then enables premium options. Is there a better way to link all of these web requests and just make ...
-4
votes
1answer
748 views

Winforms tree view checking/unchecking

How can I improve the tree searching algorithm, or can I? ...
18
votes
6answers
9k 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 (...
2
votes
3answers
2k views

A weather application

I have recently picked up c# using visual studio and set myself a project to create a weather application. I would like a peer review of my code so I find areas where I can improve and learn more best ...
6
votes
3answers
889 views

Checking whether textboxes have data

I always end up creating a quick return statement above a code block if the simple condition of textbox null fields are found. Naturally, these tend to build up the more controls are added. Now I'm ...
1
vote
1answer
840 views

Winforms tools for selection of items using ComboBox - binding datasource

This is mi UserControl containing ComboBox and few buttons for selecting and manipulating collection of items which implement simple interface IHasHeader (just ...
3
votes
2answers
110 views

Update/Insert/Delete on a particular database table

I'm updating a solution that I wrote a while ago. I've got a WinForm that does Update/Insert/Delete on a particular database table. I've got all of the database access code in the form. Is this bad ...
7
votes
3answers
837 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 ...
18
votes
3answers
483 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 ...
37
votes
4answers
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 ...
3
votes
1answer
314 views

Using graphics to draw on form, in C#

I have a form, which I want to draw on-top some shapes. To be exact, rectangles and lines. This is the "Redraw" method. I call this method every 100ms from a different thread. ...
3
votes
1answer
144 views

Looping through the values of two ComboBoxes by pressing a button

I have a C# application where I have implemented the MVP pattern. On one of my forms I have two ComboBoxes with values through which I loop with a button press. The first ComboBox contains different ...
6
votes
2answers
5k views

Creating multiple threads to process items in a listview

The goal is to pick items from a listview, do some web related task with the information and then update the UI with the returned information from the web request. The problem is with having multiple ...
6
votes
2answers
398 views

Memory test in windows forms

I've made a memory test game in windows forms, where you need to find and match 2 cards with the same images. It has 3 difficulties : Easy - 4 different pairs of cards, no time limit, no mistakes ...
-1
votes
1answer
64 views

Creating points in specific size [closed]

The method is in a new class and i use it from form1: In the top of the new class: public int numberOfPoints = 100; The class Init method: ...
6
votes
1answer
334 views

Clicking game in windows forms

I've made a simple clicking game where you spam a button in order to get coins which you can use to buy upgrades to get even more coins. I've only 2 classes one that is responsible for the game logic ...
3
votes
1answer
293 views

Tic Tac Toe implemented in WinForms using Model-Viewer-Presenter Pattern

I had to build a 2-player Tic Tac Toe app in C# w/ WinForms for a pre-interview screen. I got past that stage successfully and the app works flawlessly, but I would like to get some feedback. ...
11
votes
2answers
6k 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 ...
1
vote
3answers
195 views

Project Euler problem solver in windows forms

I've programmed a few Project Euler problem but they are all separated in different solutions so I decided to group them all together in a nice Windows forms application. Here's how it looks like : ...
3
votes
3answers
506 views

Presenter creating Views in c# MVP

I have a c# WinForms application in which I have tried to implement the Model View Presenter pattern with Passive View. I create new Views in the Presenter of my 'home screen'. I was wondering if this ...
1
vote
1answer
4k 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 (...
4
votes
1answer
2k 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
107 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 ...
11
votes
3answers
3k 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
495 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 ...
1
vote
2answers
214 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 ...
1
vote
0answers
483 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 '...
2
votes
1answer
517 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 ...
6
votes
3answers
9k 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
4k 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 ...
5
votes
1answer
2k 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 ...
2
votes
0answers
695 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
531 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
317 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 ...
0
votes
0answers
200 views

DataTable extension methods and proper disposing of unneeded resources

I've build two extension methods, that allows me to show DataTable inside window. Below is my code: ...
2
votes
0answers
189 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
3k 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? ...
5
votes
2answers
110 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
143 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: ...
11
votes
5answers
6k 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: ...
8
votes
3answers
3k 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
966 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:...
16
votes
1answer
33k 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 ...
4
votes
1answer
967 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 ...