11,217 questions with C#-related tags

Sort by: Updated
0 answers

Issue to write to the file

Hi, I used the way like using (StreamWriter sw = new StreamWriter(@"z:/oup2.txt", allowappend, Encoding.Unicode)) to write to the output text file but it does work well. Is it being affected by the file type (like Ansi or Unicode one)?

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.
11,217 questions
asked 2025-01-22T02:44:54.6033333+00:00
Peter_1985 2,691 Reputation points
1 answer

windows.opener() handling with WebView2

In the webform, I have used window.opener for opening a new window that acted as a dialog which required user input, and needed to pass information back to the main window. I am trying to embed this in winform using WebView2 control.The…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,919 questions
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.
11,217 questions
asked 2025-01-13T06:37:06.7133333+00:00
Neha 20 Reputation points
commented 2025-01-22T02:15:22.47+00:00
Roy Li - MSFT 33,586 Reputation points Microsoft Vendor
2 answers

SqlDataReader error “Invalid attempt to read when no data is present”

My environment used is Visual Studio 2022 v17.12.4. Language is C# and connecting to SQL Server Express v16.0.1135.2. This is a Windows form using .Net Framework 4.8.1. I am getting the error message “Invalid attempt to read when no data is present”…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,060 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,341 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.
11,217 questions
asked 2025-01-21T22:31:10.9133333+00:00
Pat 0 Reputation points
edited an answer 2025-01-22T01:46:11.89+00:00
SurferOnWww 3,706 Reputation points
2 answers

How Can I Detect if the System Clock is Moved Forward or Backward in a C# WPF Application?

Hello, In my C# WPF desktop project, I want to detect if the system clock has been moved forward or backward. When such a change is detected, I would like to take specific actions. For example: Show a warning if the system clock is moved forward. Log an…

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,814 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.
11,217 questions
asked 2025-01-16T10:34:03.34+00:00
fatih uyanık 180 Reputation points
commented 2025-01-22T01:11:45.28+00:00
Hongrui Yu-MSFT 4,040 Reputation points Microsoft Vendor
1 answer

I want to disable/enable usb and HDMI port whenever my c# wpf (.net Framework 4.7.2) app runs.

Online resources are not present for above queries. I want solution for both admin/non-admin user account. Please help to provide me the solution.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,060 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,814 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,712 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.
11,217 questions
asked 2025-01-15T12:29:34.7333333+00:00
Vishal2 Bansal 205 Reputation points
commented 2025-01-22T01:10:42.5833333+00:00
Hongrui Yu-MSFT 4,040 Reputation points Microsoft Vendor
1 answer

Visual Studio failed to publish to Azure Container Registry

Hi, I have an ASP.NET Core application that I am trying to migrate to Azure. I am using Azure Container Registry to publish my app's images and run it on Container App. Until a few days ago, I was able to successfully push the image to the container…

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
477 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,745 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.
11,217 questions
asked 2025-01-21T15:33:13.06+00:00
Pampua84 1 Reputation point
edited the question 2025-01-22T00:50:08.57+00:00
Anna Xiu-MSFT 30,791 Reputation points Microsoft Vendor
2 answers

Office Outlook Interop Issue

I recently started having an issue with our email reading utility after the December 2024 Outlook update. I can no longer read email body from a folder. VS 2022 keeps crashing giving generic access errors. Error Section Snippet: mi.EmailBodyText =…

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.
11,217 questions
asked 2025-01-15T17:30:42.0633333+00:00
Micah Holmes 1 Reputation point
answered 2025-01-21T21:32:54.51+00:00
Micah Holmes 1 Reputation point
0 answers

Cannot Connect Locally to when using Microsoft.CognitiveServices.Speech

Hello Everyone, I am trying to build a method that detects the language of the audio I provide it. My application translates audio but since we batch transcribe and also use a custom model, I cannot use languageIdentification. Therefore, I am trying to…

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,867 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.
11,217 questions
asked 2025-01-03T20:09:00.52+00:00
Michael Lanctot 0 Reputation points
commented 2025-01-21T20:31:22.5633333+00:00
89737969 0 Reputation points
1 answer One of the answers was accepted by the question author.

How to implement alternating row colors in a ListView using Windows App SDK

I have a Windows App SDK app that has a ListView, and I want the row colors to alternate. What is the best way to achieve this?

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.
813 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.
11,217 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
830 questions
asked 2025-01-19T20:09:53.58+00:00
jm6271 20 Reputation points
accepted 2025-01-21T17:48:42.4266667+00:00
jm6271 20 Reputation points
3 answers

How to view my content from my database to my home view in .Net core MVC

Hi guys SO I was learning to use .NET Core MVC through the tutorial, and I decided to take it up a notch. While the tutorial has been helpful, it did not really have what I was looking for, and surprisingly, neither do all the AI bots. So what's the…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,745 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,341 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.
11,217 questions
asked 2025-01-18T15:28:13.7133333+00:00
Assadullah Sanusi 0 Reputation points
commented 2025-01-21T17:14:07.4166667+00:00
JZMDI3489 0 Reputation points
1 answer One of the answers was accepted by the question author.

Could not find a part of the path '/tmp/functions\standby\wwwroot/Templates/template1.html'. ReadAllText on Linux Azure functions app seems not to append correct root path.

Following line of code is breaking for Azure function app in Flex Consumption plan with .net 8 Isolated worker, while its working perfectly on local windows machine. Even though I am using Path.Join for platform specific separator. Here templatePath is…

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,336 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,060 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.
11,217 questions
asked 2025-01-21T12:43:59.6333333+00:00
Abhishek Chandel 0 Reputation points
accepted 2025-01-21T14:26:49.1333333+00:00
Abhishek Chandel 0 Reputation points
1 answer One of the answers was accepted by the question author.

Timer in windows Service C# Finish before the task ended

Hello, I am creating a Windows service using C#. The program is designed to send SMS messages every 3 seconds. However, sometimes the task takes longer than 3 seconds, resulting in duplicate messages being sent to the user. What advice do you have for…

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,728 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.
11,217 questions
asked 2025-01-21T08:04:12.0133333+00:00
عبدالمجيد العتيبي 21 Reputation points
commented 2025-01-21T11:35:33.3033333+00:00
عبدالمجيد العتيبي 21 Reputation points
1 answer

IVI.visa could not be found

My computer A prompted a message notifying me that the latest update for the NI driver was available, so I decided to update it. After the update, I noticed that the executable file compiled with Visual Studio 2015 runs successfully on Computer A but…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,368 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.
11,217 questions
asked 2025-01-20T03:24:20.1533333+00:00
Rr 0 Reputation points
edited a comment 2025-01-21T09:59:38.87+00:00
Rr 0 Reputation points
1 answer

VS 2022 wrongly reports error CS0246

Visual Studio 2022 (version 17.12.4) is reporting error CS0246 'type or namespace could not be found...' for a class EposNowReportsDataSnapshot in a declaration: EposNowReportsDataSnapshot dataSnap = new EposNowReportsDataSnapshot(); The error report is…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,368 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.
11,217 questions
asked 2025-01-19T22:11:58.6866667+00:00
Frank Hindle 0 Reputation points
edited an answer 2025-01-21T08:14:34.9866667+00:00
Tianyu Sun-MSFT 32,416 Reputation points Microsoft Vendor
0 answers

How to Disable Scrolling in a Navigation View with WindowsAppSDK

I have a WindowsAppSDK app that uses a navigation view control for navigation. For one of the pages, scrolling should be disabled, allowing the page to shrink to fit within the navigation view's content pane. How can scrolling be disabled and the page…

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.
813 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.
11,217 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
830 questions
asked 2025-01-17T22:59:10.8633333+00:00
jm6271 20 Reputation points
commented 2025-01-21T06:39:35.0833333+00:00
Roy Li - MSFT 33,586 Reputation points Microsoft Vendor
2 answers

I can't find the Blazor Web Assembly option, I only see two options the Blazor Web App and the standalone Web Assembly application but none of them give me the ASP .NET Core Hosted option, why?

I do have a question related to this topic because I want to start a project with the Blazor WebAssembly App template but it is no longer only those two that you mention. according to a video it should look like this: I would like to know if the way I…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,745 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,650 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,368 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.
11,217 questions
asked 2025-01-20T17:12:21.9833333+00:00
Carlos Enrique Canales L�pez 0 Reputation points
commented 2025-01-21T03:43:07.9366667+00:00
Tiny Wang-MSFT 3,066 Reputation points Microsoft Vendor
1 answer

I want to lock the current HDMI port in C# WPF (.NET Framework)?

I want to lock the HDMI port. If a HDMI port is used for a monitor then if other HDMI port is used then i want to lock existing port. How to do so in C# WPF?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,060 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,814 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,712 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.
11,217 questions
asked 2025-01-16T08:11:55.82+00:00
Vishal2 Bansal 205 Reputation points
commented 2025-01-21T02:12:18.4466667+00:00
Roy Li - MSFT 33,586 Reputation points Microsoft Vendor
2 answers

Permissions to access shared mailbox to read and send emails

I'm building an service which will read emails from a shared mailbox and then reply to those emails. It will run in a service, so I'm using app permissions instead of delegated permissions. It's a multitenant application so I've created an app in our…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,745 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,824 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.
11,217 questions
asked 2025-01-19T22:09:30.6266667+00:00
jgauffin 0 Reputation points
answered 2025-01-20T23:04:13.81+00:00
Bruce (SqlWork.com) 69,806 Reputation points
1 answer One of the answers was accepted by the question author.

SetSystemTimeAdjustment disable clock adjust rather than changing the RTC clock rate

I need to override w32tm to adjust the DateTime clock-rate in C#. When I call the kernel32 API: SetSystemTimeAdjustment(ref dwTimeAdjustment, ref bTimeAdjustmentDisabled); I get a return of true, indicating it worked, but when I read back the…

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,712 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.
11,217 questions
asked 2025-01-20T03:59:44.49+00:00
Tom Stoltz 20 Reputation points
commented 2025-01-20T17:32:05.6533333+00:00
Tom Stoltz 20 Reputation points
2 answers

Get Absolute URL in Blazor class

Hello, I have a class inside the Services folder. It contains a LogError(Exception ex) method in which I need the absolute URL in order to get the requested page. However, I am unable to access the HttpContext.Request.Url or any other method/extension…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,745 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,650 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,571 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.
11,217 questions
asked 2025-01-20T14:00:42.1733333+00:00
Kuler Master 386 Reputation points
answered 2025-01-20T17:21:02.4366667+00:00
Bruce (SqlWork.com) 69,806 Reputation points