10,234 questions with C#-related tags

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

How to GET current primary mouse button settings using Win32 c#

For setting the primary button I am using the SystemParametersInfoA method. const int SPI_SETMOUSEBUTTONSWAP = 33; SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, button, String.Empty, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); But for getting 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,421 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,234 questions
asked 2021-12-22T09:11:29.237+00:00
Jone Selas 81 Reputation points
accepted 2021-12-22T09:41:33.527+00:00
Jone Selas 81 Reputation points
2 answers

How to add a text file in to existing datatable as a new column

I have to add a data column in to the existing data table. I need to add one more column and data to that table from a .txt file in to 0th column and from second column i need to keep the DB data. I am not using any grid view and stream reader to my…

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,234 questions
asked 2021-12-14T21:37:41.407+00:00
RAMAN RAGAVAN 51 Reputation points
commented 2021-12-22T05:49:14.753+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
1 answer

Oracle Data Adapter recovering files don't bring special characters like ñ

Hi, I'm having an issue when I'm trying to recover data from Oracle into a DataTable. Some files in Oracle, contains characters like ñ but in the DataTable results, that character turns in this: "?" I'm using this code: static string…

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,234 questions
asked 2021-12-14T17:50:25.197+00:00
programinca 21 Reputation points
commented 2021-12-22T05:48:06.393+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
0 answers

Control not firing after adding to parent control

I'm creating my own ComboBox using a button with a ListBox which I add to the parent control of the button. The SelectedIndexChanged does not fire if the index is changing in the ListBox (ie user selection) but does fire if i set it in the button…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,827 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,234 questions
asked 2021-12-12T16:35:45.53+00:00
Innovative Software Products 1 Reputation point
commented 2021-12-22T05:42:54.877+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
1 answer

I need help with appending a child to xml using c#.

<Root> <PolicyHeader> <ReceiptNo/> </PolicyHeader> I need to replace receipt no and make like this <ReceiptNo>receipt value</ReceiptNo>

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,234 questions
asked 2021-12-11T05:50:11.07+00:00
Jack_TheTechGuy 1 Reputation point
commented 2021-12-22T05:34:37.117+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
1 answer

StandardPrintController.OnStartPage(PrintDocument document, PrintPageEventArgs e) is slow

What factors will affect the performance of OnStartPage(PrintDocument document, PrintPageEventArgs e) method?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,114 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,234 questions
Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
640 questions
asked 2021-12-08T03:46:44.957+00:00
JAYLON LIU 1 Reputation point
commented 2021-12-22T05:32:08.673+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
2 answers

How to implement XML Files into Datagrid

So i have a XML File, structure looks like so: <data> <workouts> ... <workout id="3"> <start>2021-11-22T07:10:34</start> <end>2021-11-22T08:00:00</end> …

Azure Database Migration service
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,234 questions
Windows 10 Compatibility
Windows 10 Compatibility
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Compatibility: The extent to which hardware or software adheres to an accepted standard.
455 questions
asked 2021-12-06T05:59:19.607+00:00
akshan 1 Reputation point
commented 2021-12-22T05:30:25.103+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
1 answer

c# forms closing and exit without saving data

Hi, Please I need help, as I am saving recording as following into oracle database at the end of code, I want my c# form will close and exit automatically, its closing and exit but without saving data please help public void…

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,234 questions
asked 2021-12-01T18:20:56.31+00:00
Malik Asad Mahmood 126 Reputation points
commented 2021-12-22T02:35:52.117+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
2 answers

Outer and inner loops with dictionary

I have a dictionary and I want to compare its elements. I've looped over dictionaries using foreach and KeyValuePair but what I need is the outer loop to tsrat with the first key and end at the second-to-last key, then the inner loop to start at the…

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,234 questions
asked 2021-12-21T14:48:21.647+00:00
genush 1 Reputation point
answered 2021-12-21T16:19:25.767+00:00
Karen Payne MVP 35,036 Reputation points
0 answers

With EF Core 5, is it possible to reverse engineer (Scaffold-DbContext) a SQL view as an editable table?

I'm using Entity Framework Core 5 in my "database first" application. I use the 'Scaffold-DbContext' command to re-create the models whenever the database schema changes. It works great. However, I now have a SQL View that I need to update so…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
697 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,367 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,234 questions
asked 2021-12-14T15:39:56.827+00:00
Bruno71 1 Reputation point
commented 2021-12-21T13:46:59.677+00:00
Bruno71 1 Reputation point
3 answers

How can I save data/information to text file and read back ?

private void SaveData(string contentToSave, string fileName) { string applicationPath = Path.GetFullPath(System.AppDomain.CurrentDomain.BaseDirectory); // the directory that your program is installed in string saveFilePath…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,827 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,234 questions
asked 2021-12-21T05:01:02.123+00:00
rhodanny 166 Reputation points
answered 2021-12-21T12:05:29.187+00:00
Karen Payne MVP 35,036 Reputation points
2 answers One of the answers was accepted by the question author.

How to access properties of exception.

I want to access the properties of Fault Exception Object in catch block in order to catch the real cause of exception and store it into my log. The problem is , the properties are accessible only at runtime (when the exception is thrown) not…

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,234 questions
asked 2021-12-21T09:14:08.707+00:00
Imran Jalali 101 Reputation points
commented 2021-12-21T09:57:50.207+00:00
Imran Jalali 101 Reputation points
1 answer One of the answers was accepted by the question author.

How to automatically play a local MP4 file using WebView2 in Windows 10?

Hello: I have a number of MP4 files in my local hard drive. I want to play them automatically in WebView2. How I can do this? For example, I have one MP4 file: C:\Video2\1.mp4. I can launch ME Edge, and press Ctrl-O to open this mp4 file and…

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,234 questions
asked 2021-12-16T10:42:36.057+00:00
john zyd 421 Reputation points
accepted 2021-12-21T09:13:27.23+00:00
john zyd 421 Reputation points
1 answer

How can I clear cookies from MS Edge programmatically using C#.NET

Like in IE we use rundll32.exe for clearing cache and cookies. For Latest version of Edge I tried using this path : LocalAppData\Microsoft\Edge\User Data\Default. In this path I tried deleting the cookies file but issue is that after deleting the…

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,127 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,234 questions
asked 2021-12-10T15:05:09.767+00:00
akshitjain 1 Reputation point
commented 2021-12-21T08:24:50.51+00:00
XuDong Peng-MSFT 10,096 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

Bridge.net .Net Framework 4.5 - You must add a reference to assembly mscorlib, Version=4.0.0.0

I'm trying to use Bridge.net, it's targeting .NET Framework 4.5 and I added a reference on the project to a custom library (.NET Framework 4.5) but when I try to inherit from a class within this library I get the error about mscorlib. I tried the only…

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,234 questions
asked 2021-12-20T10:10:59.17+00:00
Alexandre Caila 21 Reputation points
accepted 2021-12-21T07:50:29.113+00:00
Alexandre Caila 21 Reputation points
0 answers

I cant figure out why the method returns returnVal="test" and doestn change to the correct value

this is the foreach: foreach (StudentResult item in studentResult) { LbInfo.Items.Add(item.GetInfo()); } method GetInfo() is from the Class StudentResult public string GetInfo() { …

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,234 questions
asked 2021-12-17T10:42:02.63+00:00
stoyan grozdev 21 Reputation points
commented 2021-12-21T07:31:42.973+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
2 answers One of the answers was accepted by the question author.

system.text.json with dynamic object names

I have a problem with dynamic object names. Can anyone please help me with deserializing this json into c# classes: { "WohnzimmerEG": { "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem", …

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,234 questions
asked 2021-12-20T08:21:59.243+00:00
Bernd Schmal 21 Reputation points
accepted 2021-12-21T07:05:45.577+00:00
Bernd Schmal 21 Reputation points
1 answer

How can I stop/start the timer in user control through form1 ?

The user control code : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,827 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,234 questions
asked 2021-12-20T05:41:36.107+00:00
rhodanny 166 Reputation points
commented 2021-12-21T06:23:32.743+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor
0 answers

Visual Studio and function Navigation bar issue

See me picture first. my function dropdown not showing full function name. there is no horizontal scrollbar at bottom of dropdown. so i am not able to show full function name. please suggest a solution. thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,600 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,234 questions
asked 2021-12-17T15:53:41.19+00:00
T.Zacks 3,986 Reputation points
commented 2021-12-21T06:07:08.52+00:00
Tianyu Sun-MSFT 27,266 Reputation points Microsoft Vendor
1 answer

How to read data from Json object

Hi All, I am getting the data as below. Please help me how to read the data of Head_TO_Res_Det and Head_TO_Pos_Det string jsonString =…

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,234 questions
asked 2021-12-18T14:45:56.607+00:00
Murari Ram 21 Reputation points
commented 2021-12-21T01:31:17.18+00:00
Jack J Jun 24,286 Reputation points Microsoft Vendor