Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
3
votes
3answers
9k views

Showing/hiding controls based on event

I have the following code in a portion of my program that hides/shows certain elements based on the status of a certain checkbox: ...
3
votes
2answers
303 views

Any way to speed up this UPDATE?

SQL: ...
5
votes
1answer
354 views

Ideas for reducing repetition in control binding

I have seven checkboxes on a data maintenance WinForm, which indicate the days of the week that are "valid" for a particular operation to be performed. These "map" to a list of DayOfWeek enum values ...
0
votes
1answer
4k views

Self-hosting WCF in Windows Forms without another Windows process [closed]

I have a Windows application and want to self-host a WCF in it. This MSDN article walks you through how to self-host WCF in a console. Jason Henderson's article demonstrates how to call the service. ...
5
votes
2answers
19k views

Moving List View items from one list to another

I'm writing a form that contains 2 ListViews with a set of 4 buttons. 2 move all the items from one to the other in each direction, the other move only selected items in each direction. Nothing fancy ...
1
vote
1answer
182 views

What should I do to improve this snippet

Though it works I wonder if there might be a better way to do this. I would like to reuse this loading and establishing of fields of another class(es) (the static TileMapper class mentioned at the end)...
2
votes
4answers
2k views

Refactoring Event Handlers - How to go about this for growing WinForms application

I have a class with approximately 140 menu buttons in a nested ribbon-style menu over a canvas type area within a WinForms application. As a result of this, a large swathe of my codebehind file ...
3
votes
1answer
3k views

Query a remote computer using WMI, and return the installed printers in a datagridview

I have an application that has multiple functions. Two in particular will query a remote computer using WMI, and return the installed printers in a datagridview. The other is a new method that will ...
0
votes
2answers
16k views

Getting data from database and then outputing it to the DataGridView

I am at the point where I feel that I am not doing it right. It works and does the job, but I am sure that there are more efficient and smarter ways of doing it. I would like to see if there is a way ...
4
votes
1answer
473 views

Is there a more elegant way of arranging my forms?

I'm a rather novice programmer who recently came up with a solution that works for my project, however I'm always looking for ways to improve my code. So essentially, I have a settings form that pop'...
5
votes
1answer
4k views

Binding FlowLayoutPanel

I'm trying to create a Bindable FlowLayoutPanel that can take a DataSource and map it the specified generic parameter ...
1
vote
1answer
790 views

Persisting objects in a ListBox ObjectCollection

I have a C# WinForms app containing a ListBox control, which I populate with objects of type BukkitServer. When an object is ...
2
votes
2answers
2k views

C# Winforms: Is there any way to improve this simple custom Textbox code?

I have been working on Custom TextBox control, which only allows alphanumeric characters. Note that I have not restricted characters from KeyPress, KeyUp event as I don't want to restrict copy/paste ...
3
votes
1answer
225 views

Capturing a string in a specific format

I have a requirement to capture a string in a specific format of * [Numeric Digits] *. This is how I have done right now but I think it would be faster with Regular ...
3
votes
2answers
6k views

Switching back and forth between forms

Topic 1: Switching to another form from the project startup form I use the following code that calls an instance of my form for payment (frmPayment) from my ...
5
votes
2answers
426 views

Retrieving data based upon text entered in a textbox

I have two text boxes and one combobox. I am retrieving the data based upon the text entered into the text boxes and combobox selection, by using the following method: ...
3
votes
1answer
8k views

Image processing optimization

I'm using Winforms C# .NET 3.5. I'm getting frames, and this is how I handle them: ...
1
vote
1answer
4k views

Properly creating a Task to poll and dispatch child tasks with cancellation for each

I'm creating a dispatcher class - which is itself a long running task which can be cancelled at anytime by the user. This Task will poll the database to see if there is any work that needs to be done,...
4
votes
2answers
621 views

Is this validation sufficient to ensure that the vals are not empty?

I'm working on a small winforms app, the goal of which is to capture data and write to xml. I'm still a child where programming is concerned so could you guys please take a look and suggest changes as ...
6
votes
3answers
1k views

Returning a large number of values from a thread

I have an application in which I am querying an XML web service continuously every 2 seconds in a thread. The returned XML is very big and I am retrieving lots of stuff from them using XPath and ...
6
votes
3answers
44k views

Programatically creating context menu

I have the need to programatically create a context menu using names for the menu items which aren't known until the program loads user data. Here's how I have implemented it. I'm not happy with the ...
6
votes
1answer
4k views

Why is this code to paste into a DataGridView so slow?

...
10
votes
1answer
899 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: <...
3
votes
1answer
747 views

Retrieving context menus from the form

I have the following code which is a private method inside the form and retrieve all context menus from the form. I feel, that it is not that concise as it should be. Would be grateful for any ...
13
votes
6answers
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 ...
73
votes
8answers
215k 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 ...
20
votes
3answers
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 ...