Microsoft Q&A

C#

9,073 questions

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

Browse all C# tags

9,073 questions with C#-related tags

Sort by: Updated
2 answers

How to develop .net full framework 4.8 class library with VS2022

Using VS2022 and it's a long time since I needed to develop anything non net core stuff. However, today I needed to make a class library targeting .net 4.8 but am not able to find any template other than the core "family" of frameworks as shown…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-03-07T19:50:35.7733333+00:00
EuroEager2008 141 Reputation points
edited a comment 2023-10-08T19:24:06.9966667+00:00
glenb 21 Reputation points
1 answer

My solution contains absolute paths to projects inside the solution folder

I have a solution where all the projects are inside the solution's folder. But VS Community 2022 insists on writing their location in the solution file and other project files as absolute paths. Now when I check everything into Git, VS doesn't upload…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
2,098 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T11:21:27.9966667+00:00
Will Pittenger 281 Reputation points
edited an answer 2023-10-08T17:49:36.42+00:00
Bruce (SqlWork.com) 45,221 Reputation points
1 answer

the outputData has some unrecognized text?

var processInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "", UseShellExecute = false, RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardInput = true, …

.NET
.NET
Microsoft Technologies based on the .NET software framework.
2,098 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
300 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: The period of time during which a program is being executed in a computer.
1,047 questions
asked 2023-10-08T06:56:21.13+00:00
mc 2,706 Reputation points
answered 2023-10-08T17:13:40.8633333+00:00
Bruce (SqlWork.com) 45,221 Reputation points
1 answer

Toast notifies that an exception has occurred

As shown in the picture: my Toast notifications throw this exception: System.Runtime.InteropServices.COMException: "Unspecified error", I copied and pasted https://learn.microsoft.com…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
2,098 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
610 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,113 questions
asked 2023-10-05T10:04:44.2233333+00:00
Starcloudsea 40 Reputation points
commented 2023-10-08T14:40:52.3166667+00:00
Castorix31 77,846 Reputation points
0 answers

How to remove the red lines?

Dear All, How to remove the red lines?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T14:37:26.7666667+00:00
BenTam 1,001 Reputation points
3 answers

Visual Studio 2022 & C# Generates Gen:Variant.MSILHeracles.46462 Virus

I am just now learning C# in VS 2022 and when running the simple program shown below Bitdefender detected and quarantined what it considers a virus and generated the message shown below. I suspect this is a false-positive, but I wanted to post this here…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2022-11-10T15:39:18.357+00:00
Bob Wentzel 6 Reputation points
answered 2023-10-08T13:50:41.33+00:00
azurabennett 0 Reputation points
0 answers

Form's control reference in CustomControl

public partial class sale_purchase_datagridview : DataGridView { private SqlConnection con; private SqlDataAdapter da; private DataTable dt, dt2; private DataSet dataSet; private DataView dataView; …

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T13:40:09.3833333+00:00
OmkarHcl 166 Reputation points
1 answer

Sizing the column header's

Hi , I have a datagridview with 5 columns . during run time i saw that there is some space left as shown the figure . Can we adjust it at so that it must not show if in the future the number of columns increase or decrease .

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T11:49:48.1333333+00:00
OmkarHcl 166 Reputation points
edited a comment 2023-10-08T13:22:49.4366667+00:00
KOZ6.0 1,785 Reputation points
1 answer One of the answers was accepted by the question author.

Request for Entity Framework Version for SQL Server Databases

Hello I am using .NET Framework 4.8. I would like to download Entity Framework that supports commands such as Add-Migration, Bundle-Migration, Update Database, Drop Database, Remove Migration, and Get DbContext for SQL Server databases. Which version…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T07:39:01.8433333+00:00
asem alsaif 0 Reputation points
accepted 2023-10-08T13:12:32.23+00:00
asem alsaif 0 Reputation points
1 answer One of the answers was accepted by the question author.

Column Count Error in datagridview

public partial class sale_purchase_datagridview : DataGridView { private SqlConnection con; private SqlDataAdapter da; private DataTable dt, dt2; public sale_purchase_datagridview() { …

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-08T11:32:22.53+00:00
OmkarHcl 166 Reputation points
accepted 2023-10-08T12:32:35.7566667+00:00
OmkarHcl 166 Reputation points
1 answer One of the answers was accepted by the question author.

Add watermark to PDF file

Hello I tried to adapt the codes below from the internet, but as a result I get a PDF printout without watermark. I wonder where the error is. source code > https://www.pdfsharp.net/wiki/Watermark-sample.ashx string watermark = "DENEME"; …

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-07T18:06:03.3566667+00:00
sahin kaya 0 Reputation points
commented 2023-10-08T10:43:01.4733333+00:00
sahin kaya 0 Reputation points
2 answers

Adjust records height inside datagridview

the above is a screenshot of my datagridview which has 20records . on initial display it is showing 17 records but the 17th record seems to cut off , how to fix this . also in the same example , i have also used the below code to make the selected…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-07T07:12:53.9733333+00:00
ankit goel 626 Reputation points
edited an answer 2023-10-08T09:01:33.7133333+00:00
KOZ6.0 1,785 Reputation points
4 answers

How to open or launch my desktop application(windows application) developed using C# in browser

I have to launch or open my desktop application developed using C# in the browser? please give me some suggestions on how to achieve it ? Thanks in advance. Explanation: I have a windows app XYZ.exe so I need to open this application from the browser. so…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-01-23T06:11:55.94+00:00
Dineshkumar.S 426 Reputation points
answered 2023-10-08T03:41:55.2066667+00:00
aluzi liu 366 Reputation points
5 answers

Couldn't process file Form1.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file

I downloaded code https://learn.microsoft.com/answers/users/53807/karenpayneoregon.html but when I opened the solution file in VS2022 it gives me this error: Couldn't process file Form1.resx due to its being in the Internet or Restricted zone or…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2022-08-03T17:48:45.883+00:00
Juan Dent 236 Reputation points
commented 2023-10-08T01:57:50.2533333+00:00
Khadim Hussain 0 Reputation points
2 answers One of the answers was accepted by the question author.

Error when try read data from Excel File in ASP.NET MVC

In an ASP.NET MVC app, I am trying to read data from Excel file but I get this error: The error appears in production mode, but in development mode there's no problem. I am making host on Local Host on my computer Microsoft Excel cannot access the file…

Internet Information Services
ASP.NET MVC
ASP.NET MVC
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
990 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-03T17:37:39.96+00:00
mostafa ahmed 21 Reputation points
accepted 2023-10-07T21:52:57.37+00:00
mostafa ahmed 21 Reputation points
1 answer

RegEx pattern problem

Hello, I need to split this string into a list. But no pattern works. The easiest thing would be to get the value of all key words back as a string. What is here the right way? string pattern =…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-06T17:52:40.47+00:00
Markus Freitag 3,381 Reputation points
edited a comment 2023-10-07T19:54:25.38+00:00
Viorel 103.6K Reputation points
1 answer

Clear text on pressing escape key

I am a new learner in c# and windows forms . I, in my org . have created a custom datagridview . it has four columns . but i am stuck at a task in which on presses escape key in the first three columns ,whatever data we have typed in , we need to clear…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,653 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-06T21:37:58+00:00
vijay kumar 100 Reputation points
edited a comment 2023-10-07T16:46:24.4966667+00:00
KOZ6.0 1,785 Reputation points
3 answers One of the answers was accepted by the question author.

Got CS4036 error 'IAsyncOperation<BluetoothLEDevice>' does not contain a definition for 'GetAwaiter' ....

Hello, I am getting this error but I do not know how to recover it. Error CS4036 'IAsyncOperation<BluetoothLEDevice>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2022-11-27T08:39:55.993+00:00
Maurizio Bonelli 21 Reputation points
commented 2023-10-07T16:38:40.3766667+00:00
Phillip Smelt 0 Reputation points
1 answer

Positional Record vs Nominal Record in C#

Hello, Which one is positional record and which one is nominal record? What are the differences between these? public record Person1 // Is this positional record or nominal record? What are the differences between these? { public…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-07T13:09:04.2966667+00:00
Shervan360 1,411 Reputation points
answered 2023-10-07T13:22:37.2233333+00:00
Karen Payne MVP 33,541 Reputation points
0 answers

url to pdf - using evohtmltopdf namespace - edge browser - first attempt fails

I am using evohtmltopdf library to convert formed url to pdf on a button click pdf generates with google chrome successfully at first attempt but with edge browser it fails with error at first attempt when I click back space and click on the same…

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
1,648 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,073 questions
asked 2023-10-07T08:36:51.86+00:00
Illuri, Vishnu Vardhan 0 Reputation points
commented 2023-10-07T11:11:59.4566667+00:00
AgaveJoe 695 Reputation points