All Questions
138
questions
37
votes
2
answers
64k
views
How to update StatusStrip in Windows Forms
I am trying to update the status strip in my Windows Forms application, but nothing is being displayed. Here is my code:
private void textBox1_TextChanged(object sender, EventArgs e)
{
lines = ...
13
votes
1
answer
631
views
Why do multiple font sizes display inside Plain TextBox?
This is not a question about how to change the font size. Rather, why is the size of my font changing by itself as I type (or paste) when it's inside a plain TextBox control which, as you should know, ...
10
votes
2
answers
6k
views
Why does the SelectedIndexChanged event fire in a ListBox when the selected item is modified?
We are given a Windows Form Application created from Microsoft Visual Studio's template (designer code on PasteBin 1 2 3 4) with a default ListBox exampleListBox and Button exampleButton.
We populate ...
8
votes
3
answers
13k
views
DataGridView button text not appearing despite UseColumnTextForButtonText set to true
I've added a button column to a DataGridView and want to display the text "Compare" on it. I've set the Text property to Compare and UseColumnTextForButtonValue to True, but no text displays:
This is ...
7
votes
3
answers
14k
views
In C#, is it possible to open a URL in the background, without opening a browser?
My code needs to supply some information to a server via a php script.
Basically I want to call www.sitename.com/example.php?var1=1&var2=2&var3=3 but I don't want the browser to open, so ...
6
votes
1
answer
4k
views
Task Parallel Library Code Freezes in a Windows Forms Application - Works fine as a Windows Console Application
This question is a follow-up to a previous question that I had asked:
How to Perform Multiple "Pings" in Parallel using C#
I was able to get the accepted answer (a Windows console ...
5
votes
3
answers
25k
views
Convert Minutes to Milliseconds
The Timer class in Winforms has a property called, Interval and it
Gets or sets the time, in milliseconds, before the Tick event is raised relative to the last occurrence of the Tick event.
On my ...
5
votes
2
answers
10k
views
How can I create call an async method inside another async method without it stalling
I need to call multiple async methods and inside of them, call another async method aswell.
Let me demonstrate
private async void button1_Click(object sender, EventArgs e)
{
for(int i = 0; i< ...
5
votes
2
answers
714
views
In visual studio, how do you break the debugger when a property changes that you do not own in a managed language (like C#)
I've got a weird situation where something is setting the TopMost property of the main MDI form to true. After much trial and error we're pretty sure this must be coming from a third party library ...
5
votes
2
answers
2k
views
ListBox SelectedValueChanged/SelectedIndexChanged not firing when data source changes
I need to keep track of the selected item on a ListBox to update/disable other controls according to the currently selected value.
This is the code to reproduce the issue:
public partial class Form1 ...
5
votes
2
answers
1k
views
Faking A Keyboard or Mouse Event
I've been trying to figure out how to fake, not simulate, keyboard and mouse input. By this I mean the system goes through the process as if the actual event occurred, such as a mouse click, but does ...
4
votes
2
answers
6k
views
Cannot write settings on app.config (or no changes are shown)
I'm creating an application on .net framework 4.5
whenever i want to load the app config values (appSettings section) and write the changes, i don't see my changes if i refresh the section. What i ...
4
votes
3
answers
5k
views
Find multiple controls with by partially matching their name
I currently have 100+ labels, with names like:
labelNumber1
labelNumber2
labelNumber3
labelNumber4
....
labelLetter1
labelLetter2
labelLetter3
labelLetter4
....
How would I find all the labels ...
4
votes
1
answer
1k
views
Assembly compiled in older .NET version running in newer .NET version, will behavior change?
I have an assembly that is compiled with .NET 3.5. I cannot recompile it in .NET 4.5 since it is used in other applications that are still running .NET 3.5. When I use the assembly in my apps that ...
4
votes
3
answers
2k
views
c# winforms - is InitializeComponent() function calling while refresh?
I want to ask about function InitializeComponent(). Is called after Invalidate() - invalidating component?
Version: .net 4.5, VS 2012
4
votes
2
answers
19k
views
Windows Forms Authentication for WinForms Application
I'm creating a Windows Forms Application with C# and .NET Framework 4.5 on my Visual Studio 2012.
I'm wanting now to create a Login Form, where the user can put some username and password (created in ...
4
votes
1
answer
2k
views
ClickOnce deployment on Windows 10 is not copying an asset folder to the client computer
I recently started having an issue with an Windows Forms application that uses ClickOnce to deploy, in that, when the install completes, it is missing a data folder that contains a zip file and some *....
4
votes
1
answer
2k
views
Multi-level Combo Box in Windows Forms
I would like to use Combo Box in my WinForms application to select only one option out of many. This choice affects the whole application and is pretty important, so I don't want to use Menu Strip for ...
4
votes
1
answer
822
views
TextBox with non editable words (tags)
I'm trying to build template editing module for my email sending application.
Right now it looks like this:
On right I have list of available variables that are replaced to correct values when I send ...
3
votes
2
answers
2k
views
WinForms Validation Without Hanging Other Controls
So, I got this problem in WinForms, at least I think its a problem, and I can't figure out how to resolve it.
Basically, when I implement a Validating event handler for a control, I set the ...
3
votes
2
answers
145
views
Do children Forms run on the same thread of the main Form by default?
If I create a child Form will it operate on the same thread as it's parent Form?
3
votes
1
answer
3k
views
Customize StronglyTyped BindingSource Item Addition
I want to customize the addition of a new item into a BindingSource (all strongly-typed) as described on the following MSDN Article:
How to: Customize Item Addition with the Windows Forms ...
3
votes
1
answer
2k
views
Thread safety when using Aforge.NET and Windows Forms [duplicate]
I'm having a lot of trouble with getting AForge.NET to play together with my Windows Forms application. The application needs a stream of bitmaps to show the video in a custom PictureBox and at the ...
3
votes
1
answer
1k
views
Getting exception on reading LevelDisplayName property in EventRecord class
I had created a windows application(C#) to read Event log files. When I am trying to read "LevelDisplayName" or "TaskDisplayName" property I get exception "System.Diagnostic.Eventing.Reader....
3
votes
1
answer
6k
views
ClickOnce error message 'Access to the path 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config' is denied'
Our ClickOnce application has been working fine. However, one of our users gets the following error:
+ Configuration system failed to initialize
+ An error occurred loading a configuration file: ...
3
votes
0
answers
87
views
How can I chain calls to Application.ThreadException?
In a WinForms application (.NET 4.5.1) if I add multiple handlers to Application.ThreadException only the most recently added handler is called. I don't see this explained anywhere in the ...
3
votes
2
answers
2k
views
Running a .NET 4.5 program on XP with .NET 2.0 [closed]
We have a Windows Service written in C# 5.0 for .NET 4.5. My code is using some of the newer language features (async and await) and framework features (Task.Run, Task.Delay, IProgress, ...
2
votes
2
answers
8k
views
Force MessageBox.Show to display on top
I have a simple winforms appl which will notify me when to add notes to my ticket. The problem I face is that when the application is minimised the messagebox doesnt show in front of all the other ...
2
votes
2
answers
2k
views
Calculate coordinates for rotated text plus bounding border
I have a form that is going to allow a user to create custom "stamps" to place on a PDF. The form displays with a image of the first page of the pdf and I want the user to basically click on the ...
2
votes
3
answers
14k
views
Resizing a windows form for any screen size
I just designed a windows forms application but when it ran on my friends smaller laptop; the
form appeared too big or should i say one had to scroll from left to right or top to down to access ...
2
votes
1
answer
8k
views
Supporting SQL Server Management objects for both SQL Server 2008 R2 and 2012 in Winforms
I have a Windows forms application targeting .NET 4.5. The application provides functionality for programmatic database backup and restore using SQL Server Management objects (SMO).
The application ...
2
votes
1
answer
101
views
WS_EX_LAYOUTRTL causing black bars on edges of controls
Using the WS_EX_LAYOUTRTL flag is causing black bars to be visible on the edges of controls. The black bars are on the left edge of each button. How can the black bars be prevented while still using ...
2
votes
1
answer
272
views
Subscribing to PropertyChangedEventHandler in Winforms
In the following example the temp variable in RaisePropertyChanged() is always null. How do I subscribe to the event?
using System;
using System.ComponentModel;
using System.ComponentModel....
2
votes
1
answer
6k
views
Change the type of a DataGridViewColumn using AutoGenerateColumns
I have a query using a dynamic pivot table which will return me a different number of columns to bind to my DataGridView. I am using AutoGenerateColumns = true...which is the only way to display the ...
2
votes
1
answer
1k
views
Winforms ListView MouseUp event firing more than once
In my .NET 4,5 Winforms application, the ListView control's MouseUp event is firing multiple times when I open a file from that event as follows:
private void ListView1_MouseUp(object sender, ...
2
votes
4
answers
3k
views
Search for specific file name in directory
I'm trying to search for specific file name on all volumes on the system, except System Volume Information or Windows Directories and print out every full path for each file.
I've tried to use ...
2
votes
1
answer
2k
views
CefSharp SetZoomLevel not working
I am using in a WinForm an object of type:
CefSharp.WinForms.ChromiumWebBrowser
Everything is working fine but I am having an issue when I try to change the ZoomLevel with SetZoomLevel method:
If ...
2
votes
1
answer
409
views
Ensure a method only fires once when an event is triggered multiple times in Winforms newer method in .NET 4.5
So essentially I have wired up three text boxes to do a smart filter and want to let a user do a multi filter. The only problem was that it was firing too frequently and I want to have it fire after ...
2
votes
0
answers
1k
views
Specifying multiple SSL protocols to be used in winform application causes exception when calling webservice for TLS1.0 server
I have a winform application built on .net framework 4.5 . I want my application to support multiple ssl protocols, hecnce I add the following code:
System.Net.ServicePointManager.SecurityProtocol = ...
2
votes
0
answers
990
views
How to close a specific Tab in Browser using UI Automation.?
I want to close a specific Tab in Browser.let's take an example such as if he try to open facebook then that tab has to closed, presently the whole process is getting killed.
AutomationElement ...
2
votes
1
answer
905
views
Winforms .NET 4.5 app is crashing on a new machine
On my development machine I have VS2010 and VS2012, developed an application using VS2012 using .NET 4.5 and Chilkat component for .NET 4 and platform target is x32 things are working fine on ...
1
vote
1
answer
2k
views
GetManifestResourceStream() returning null
I'm trying to embedd some text files on my application's resouces but when I try to retrieve it using GetManifestResourceStream() I get null. I've tried all those name combinations:
programName.Form1....
1
vote
1
answer
965
views
Simple way to introduce async during a heavy loading op
I'm working on a WinForm application that has to load a lot of data from a cloud database at the very beginning. This causes a blank form to appear hanged for as long as 20 seconds. I've tried a few ...
1
vote
3
answers
2k
views
Toolstrip labels do not update until I switch tabs
I know this will sound vague but I'll do my best explaining...I have a web scraper I made in C# which contains a few tabs on the interface. At the bottom is a toolstrip container with a few status ...
1
vote
2
answers
92
views
How to get a value from an Array via a class in Winforms using C#
I have a class called Game.cs and in the class I have the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ...
1
vote
2
answers
2k
views
Windows form open new form to display data
See below image - In my database I have 3 columns that I am interested in displaying the results through my windows form. In this example I have selected the "Spaghetti Meatballs" recipe from the ...
1
vote
2
answers
2k
views
Visual Studio 2012 suddenly crashes when moving controls on form in designer
When i move around certain elements (EDIT: narrowed it down to size/location changes to controls that have SuspendLayout,ResumeLayout and PerformLayout called on them and only if the cahnges are made ...
1
vote
1
answer
182
views
Gui becomes less responsive
First of all thanks for such a great community. I've learned a lot from your questions and answers here. This is my first question on S.O., so please be gentle :)
Ok, but first things first:
-1st code ...
1
vote
1
answer
520
views
Control locations wrong in nested SplitContainer at high DPI
Controls are in the wrong location when they are anchored to bottom or right in a SplitContainer that's in a Panel or another SplitContainer at high DPI settings like 160 % with .Net Framework 4.0 or ...
1
vote
1
answer
49
views
Need to call method as soon as server starts responding to my HttpWebRequest
I need to call a method in new thread for ex: mymethod() as soon as server starts responding to my HttpWebRequest.
I am using below to send http requst and getting response.
HttpWebRequest request = ...