10,858 questions with C#-related tags

Sort by: Updated
1 answer One of the answers was accepted by the question author.

Doesn't C# support escape sequences when we use verbatim?

Hello, I read "a verbatim string literal is prefixed with @ and does not support escape sequences." I have two questions: 1- If C# doesn't support escape sequences when we use verbatim, so how can I use an escape sequence…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 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.
10,858 questions
asked 2024-09-13T19:42:04.58+00:00
Shervan360 1,541 Reputation points
accepted 2024-09-14T19:21:29.65+00:00
Shervan360 1,541 Reputation points
1 answer One of the answers was accepted by the question author.

Passing variable argument in a loop to eventhandler

In WPF I have a Styles button in which I add items with the different styles: <Button x:Name="Form_Estilos"> <Button.ContextMenu> <ContextMenu x:Name="Form_Estilos_Items"/> <ItemsControl> …

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,762 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.
10,858 questions
asked 2024-09-05T01:52:24.05+00:00
zequion 401 Reputation points
edited the question 2024-09-14T02:56:03.4366667+00:00
zequion 401 Reputation points
2 answers

C# reading encrypted file returns Black diamonds with ? inside

I have an encrypted file that contains the following chars. áÒá,èÜÒè what I see when debugging is Black diamonds containing "?". I think my open/read file is using the wrong file data type. (unicode, ascii, etc..) and not correctly reading…

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.
10,858 questions
asked 2024-09-11T21:12:06.62+00:00
tim 160 Reputation points
answered 2024-09-13T14:44:26.0833333+00:00
Jiale Xue - MSFT 44,751 Reputation points Microsoft Vendor
1 answer

C# windows form crash

Hi, I'm writing my Windows forms project in C# using the latest versione available of Visual Studio Community (17.9.3). The project manages a Modbus TCP client connection using the NModbus library to a proprietary and tested server. The connection is…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,884 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.
10,858 questions
asked 2024-03-13T10:22:08.48+00:00
Isacco Simonini 5 Reputation points
commented 2024-09-13T14:27:01.4466667+00:00
CH Abdullah 0 Reputation points
0 answers

Number of query values and destination fields are not the same

Hi All, I received the TXT files from my vendor every morning. My objective is to convert this TXT file into Excel (.xlsx) file for my internal customer. I would appreciate it if you can point me in the right direction to resolve the issue. Thank you; I…

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,842 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,567 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.
10,858 questions
asked 2024-09-12T19:13:54.43+00:00
Douang Rintharamy 0 Reputation points
commented 2024-09-13T13:47:19.7866667+00:00
Yitzhak Khabinsky 25,851 Reputation points
1 answer

Window.GetWindow() of TabItems content does not return the right window when TabItems State changes

When using TabControl in two windows, each TabItem contains a button with a click event that displays the parent window of the TabItem using Window.GetWindow(). After DragAndDrop a TabItem from one window to another, GetWindow() still returns the…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,762 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.
10,858 questions
asked 2024-08-02T05:27:50.5833333+00:00
Karthick Arjunan 0 Reputation points
commented 2024-09-13T13:15:23.24+00:00
Karthick Arjunan 0 Reputation points
1 answer One of the answers was accepted by the question author.

Accessing certificates local storage

Hello All, We wanted to know a few things about the certificate management store and accessing the certificates using C#: Are the certificates installed in the 'Certificate Management Store' (both current user and local computer) stored in any default…

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.
10,858 questions
asked 2024-09-12T12:16:05.4166667+00:00
S Abijith 386 Reputation points
accepted 2024-09-13T11:48:22.1866667+00:00
S Abijith 386 Reputation points
0 answers

UWP How to cancel a file search

I have a code to search for files in a user's selected folder, the file search takes some time and I need to be able to cancel it if the user changes the folder QueryOptions options = new QueryOptions(CommonFileQuery.OrderByName, filesExtensions) {…

Universal Windows Platform (UWP)
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.
10,858 questions
asked 2024-09-10T15:14:33.9233333+00:00
Arsen Kovalchuk 0 Reputation points
commented 2024-09-13T09:33:56.8033333+00:00
Junjie Zhu - MSFT 17,396 Reputation points Microsoft Vendor
1 answer

Unable to fetch some group properties via C# SDK

I am trying to fetch groups via graph api and get resourceBehaviorOptions and resourceProvisioningOptions properties. Eventhough these properties exist in the direct graph api response, I am unable to find them when I use c# graph SDK. I can see these…

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,882 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.
10,858 questions
asked 2024-09-13T04:16:44.4666667+00:00
Yasitha Pandithawatta 141 Reputation points
answered 2024-09-13T08:24:37.5266667+00:00
Yakun Huang-MSFT 4,240 Reputation points Microsoft Vendor
2 answers

Connection Manager not getting Iniialized

Hi, I'm currently writing a C# code in Script Component which is making a connection to MSSQL DB using ADO.NET Connection Manager. But it returns a NullReferenceException every time when I run it. I have tried the sample code as mentioned in the link …

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,690 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,567 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.
10,858 questions
asked 2024-09-04T15:02:14.76+00:00
Mittal, Umang 0 Reputation points
commented 2024-09-13T06:09:31.59+00:00
Hui Liu-MSFT 48,506 Reputation points Microsoft Vendor
2 answers

what is the new technology to replace MFC?

I'm looking to develop a new software to replace a current version (this is a software that shows map and tracks fast moving vehicles). The current version was written in MFC C++ and MFC is becoming obsolete. My question is what new tools from Microsoft…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 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.
10,858 questions
asked 2022-12-01T23:18:46.54+00:00
Henry Tai 6 Reputation points
commented 2024-09-12T15:40:52.88+00:00
tomohiro r 0 Reputation points
1 answer One of the answers was accepted by the question author.

Taskbar Color Reverts When Changing Color Using SetWindowCompositionAttribute in WinUI3

Hi, I am encountering an issue with the taskbar color on Windows. When I change the taskbar color using the SetWindowCompositionAttribute method, the color initially changes as expected. However, as soon as I click the 'Start' button, the taskbar color…

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,332 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.
780 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,592 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.
10,858 questions
asked 2024-09-10T06:38:06.4466667+00:00
Jacob Mordon 225 Reputation points
accepted 2024-09-12T08:54:13.6366667+00:00
Jacob Mordon 225 Reputation points
0 answers

MSI application uninstall not working properly after windows update

While uninstalling our MSI Application, we have shown a custom exception message when MSI application is running in the background. To show custom message we have override the installer file . namespace SampleApplication { [RunInstaller(true)] …

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,332 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.
10,858 questions
asked 2024-09-12T06:16:40.4833333+00:00
Test Admin 176 Reputation points
edited the question 2024-09-12T07:42:44.51+00:00
Jiale Xue - MSFT 44,751 Reputation points Microsoft Vendor
2 answers

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'TenDonVi'.

At the first time, I used like this and it worked well, there is no error about this: (Controller) public ActionResult EditNV(int? id) { var nhanVien = db.NhanViens.Include(nv => nv.LichSus).FirstOrDefault(nv => nv.MSNV…

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,459 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.
10,858 questions
asked 2024-09-04T07:26:26.52+00:00
tran huy 0 Reputation points
commented 2024-09-12T06:36:56.8466667+00:00
Lan Huang-MSFT 29,246 Reputation points Microsoft Vendor
0 answers

How to binding ViewModel's SearchText variable to the DataGrid Cell as a converter parameter?

I've an other question: How to binding ViewModel's SearchText variable to the DataGrid Cell as a converter parameter. I'm using a converter to change ViewModel's list's field name: "content" to highlightedText textBlock. but the Convert method…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 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.
780 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,424 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.
10,858 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,478 questions
asked 2024-09-11T08:59:17.1733333+00:00
EdgeMac 20 Reputation points
commented 2024-09-12T03:19:03.79+00:00
Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 30,746 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

Is the October 2024 MFA enforcement applied on MSAL.NET accessing the Microsoft Graph API?

As mentioned on many channels Microsoft want to enforce MFA on administration portals, Azure CLI, Azure PowerShell, Azure Mobile app and IaC…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,882 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.
10,858 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,948 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,450 questions
asked 2024-09-10T15:39:09.63+00:00
Robin Bouwmeester 21 Reputation points
edited the question 2024-09-12T01:19:55.6466667+00:00
Xyza Xue_MSFT 24,096 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

converting VB asc() to C# Code

I'm trying to convert the following VB code to C# I'm stuck on the C# equivalent of VB's ASC this //Newstr = Newstr & chr(asc(Mid(str,x,1)) - Asc(Mid(key,KeyPos,1))) to this Newstr = Newstr & Convert.ToChar(asc(reverseString.Substring(x, 1)) -…

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.
10,858 questions
asked 2024-09-10T13:39:36.8566667+00:00
tim 160 Reputation points
commented 2024-09-11T20:51:22.2633333+00:00
tim 160 Reputation points
1 answer One of the answers was accepted by the question author.

What is the largest integer number that can be stored in a float in C#?

Hello, According to Microsoft Docs, we can store an integer up to 3.4 * 10^38, so why can't I store 100,000,001 in a float? Well, 100,000,001 is less than 3.4 * 10^38.

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.
10,858 questions
asked 2024-09-07T19:38:51.4166667+00:00
Shervan360 1,541 Reputation points
accepted 2024-09-11T14:51:13.6433333+00:00
Shervan360 1,541 Reputation points
2 answers

System.IO.FileNotFoundException: 'Could not find file '

I have the file located in my directory in C:\Users\Cerburus\source\repos\CST-150 ListToGridView\CST-150 ListToGridView\bin\Debug\net8.0-windows\Data\topic6.txt But I keep getting the exception file not found. please I need help internal class…

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.
10,858 questions
asked 2024-09-04T23:26:06.7966667+00:00
Hector A Gonzalez 0 Reputation points
commented 2024-09-11T14:47:55.4033333+00:00
Jiale Xue - MSFT 44,751 Reputation points Microsoft Vendor
2 answers

Can we store/retrieve data from Share Point list using a WPF C# application?

I am working on WPF C# application. Right now, I have the application connected to SQL database to store and retrieve data. However, I am curious to explore the options to replace it with Share Point List. So that, whatever the data I create using my WPF…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,762 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.
10,858 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,948 questions
asked 2024-08-09T07:31:07.1166667+00:00
Lakshmanan B 81 Reputation points
edited the question 2024-09-11T10:04:53.93+00:00
Yanli Jiang - MSFT 25,621 Reputation points Microsoft Vendor