99,244 questions
1
vote
1
answer
64
views
Is There a Better Way to Count the Number of Columns in an Access Database Table?
I need to count the number of columns in a Table in an Access Database.
The following code does the job, but I wonder if there is a better way using INFORMATION_SCHEMA.COLUMNS ?
CmdStr = $"...
1
vote
4
answers
3k
views
Close open Explorer windows without terminating explorer.exe
I've tried searching but nothing really matches my demand.
I don't want explorer.exe to be terminated or restarted.
I just want any open explorer windows to close.
3
votes
3
answers
27k
views
display PDF file into WinForms [closed]
I am working on a C# .Net Windows application. Here I create report using Infragistics.Documents.Report and export to .pdf & .xps format. Here I want to bringthose 2 files(.pdf & .xps) into ...
-2
votes
0
answers
61
views
Cannot set control height or width [closed]
I am working with Microsoft Visual Studio Professional 2022, C#. Using System.Windows.Forms I have a dialog with an instance of TableLayoutPanel, in the table I am creating a Label following by a ...
-1
votes
0
answers
78
views
Datagridview does not show any data
I have a datagridview in my Winforms app. I set the columns manually in designer and then try to fill it by a function. I check the function step by step and in the last line of code datasource dt has ...
1
vote
1
answer
92
views
Highlighting the datagridview rows
I have a datagridview in my Winforms app with .NET 8. I want to highlight some rows based on the current user role and the request nextlevel. I write this function and call it in form load.
But at the ...
0
votes
1
answer
305
views
How to Edit node label of treeview without raising events
Maybe the header doesn't make sense, but what I want to do is in OnBeforeLabelEdit remove the suffix from the node.
There is a problem however, because when I write node.Label.Text = "Some text ...
0
votes
1
answer
202
views
How can I disable the Maximum Path Length Limitation and move a file into a folder with a long path name?
I have vb.net winform application which creates a folder and moves some files into the folder. But when folder path goes long for example
E:\WF_2324\WF_2324_The Shadow Of The Sycamores\WF_2324_The ...
30
votes
7
answers
33k
views
Dialog MessageBox sometimes hidden behind the main form
Some of our non-technical users are having problems where a dialog MessageBox in our application can sometimes be displayed behind the main form and the application does not accept any input until the ...
Best practices
0
votes
3
replies
111
views
How to avoid that a user control changes its size when placed in tab page?
Problem: the user control's size changes when placed on the tabpage
What I tried: unset anchoring in the user control's children properties, but it didn't help.
The user control designer class:
...
0
votes
1
answer
164
views
How to set window position on different monitor from main window
It's no problem to set the position of the new WinForm inside the monitor where the main window is displayed. For example:
Form1 form = new Form1();
form.Show();
form.StartPosition = FormStartPosition....
0
votes
1
answer
104
views
Changing the version of an assembly reference is not allowed during debugging
I get this error:
Failed to emit module 'xyz': Changing the version of an assembly reference is not allowed during debugging: 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=...
1
vote
2
answers
6k
views
How to set a ToolStripMenuItem Visible in code?
I have some code in Windows Forms application.
I want to change the visibility of my drop down ToolStripMenuItems in code.
I set the Visible property, but when I set a breakpoint and inspect the ...
99
votes
5
answers
83k
views
How can I make something that catches all 'unhandled' exceptions in a WinForms application?
Up until now, I just put a try/catch block around the Application.Run in the Program.cs entry point to the program. This catches all exceptions well enough in Debug mode, but when I run the program ...
7
votes
3
answers
6k
views
What's the best way to "dim" background of winform while displaying a dialog?
I'd like to implement a feature in my application where show a dialog to the user, and the main form (similar to how jQuery looks). My only idea is to take a screenshot of the form, place it as the ...
1
vote
3
answers
478
views
MethodAccessException with the new Microsoft.Ink.dll from Windows 11 24H2
The situation is that Microsoft.Ink.dll in Windows 11 24H2 has been recompiled with .NET Framework 4.5, overwriting the same 6.1.0.0 version tied to .NET Framework 2.0. As you can see in the image the ...
0
votes
0
answers
115
views
How to see a Winforms custom control in Visual Studio designer?
I am following this tutorial to create a custom control that inherits from one different than UserControl.
When opening the designer view of this control, instead of seeing a render of the control, I ...
-2
votes
0
answers
44
views
Winform Richtextbox Undo one character instead of all text
I have a MDI parent with few types of childs, a RichTextBox in each. In one MDI child, when I Press Ctrl+Z, ALL the text I wrote in this session is deleted. But in the second MDI child, Ctrl+Z deletes ...
12
votes
3
answers
3k
views
AutoEllipsis=true affects the vertical positioning of the text
I have a label with AutoEllipsis = true and TextAlign = ContentAlignment.MiddleLeft. When I enter a text that is not extending the label width, the text is vertically aligned to the middle of the ...
-1
votes
2
answers
1k
views
How to set focus on the first input in all forms in a WinForms project?
I have one application built with WinForms with a big number of forms on it (approximately 90 forms) and now there is a requirement that when any form is opened the first input should get focused, so ...
24
votes
10
answers
21k
views
Binding to commands in WinForms
How can a button be bound to a command in a view model like in WPF with MVVM?
12
votes
13
answers
25k
views
How can one disable the first autoselect in a VS datagridview?
I have created an application in Visual Studio (C#) that makes use of a datagridview. Now, when I assign the DataSource of that datagridview, it automatically selects the first row, and executes my ...
0
votes
1
answer
9k
views
Trying to connect using PrincipalContext on Workgroup Server returns Invalid User.
I want to create an Application for editing user accounts on a Server.
The Server do not use AD only local accounts.
I use the following code to connect the remote server:
try
{
...
1
vote
1
answer
966
views
"Dynamic" mouse cursor in custom control in C# (WinForms)
I'm doing a (custom drawn) custom contol in C# (Windows.Forms).
Mouse cursor shape should depends on what part of my custom control is currently under cursor. (Let me call it "dynamic cursor"...
0
votes
1
answer
147
views
Why do Images leave giant piles of RAM behind them? [closed]
I am currently working on a .NET 9 WinForms program that contains an ImageViewer, which is a seperate window where you can scroll through a series of images.
My problem is that even after closing the ...