10,191 questions with C#-related tags

Sort by: Updated
3 answers

Windows forms App

Im am a begginer in c# and i am using visual studio 2022 i find a problem when i use windows forms using entity famework. if i use windows forms app (.NET Framework) i find this problem and when i use windows forms app i find this…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,820 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,338 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,191 questions
asked 2021-12-15T22:37:28.223+00:00
mehdi selk 1 Reputation point
answered 2021-12-27T01:08:18.347+00:00
Karen Payne MVP 35,026 Reputation points
1 answer

Create a PS Cmdlet in c# that opens a PSSession and outputs session

Hi Guys, I'm trying to create a PS Cmdlet in C# that will Creaet a PS-Session (Runspace?) and output the Ps-Session to the user. i am able to establish a connection in c# but i can't figure out how to pass it to PowerShell? (i assume i need to output a…

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,191 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,351 questions
asked 2021-12-26T21:10:56.617+00:00
Anthony Antonacci 1 Reputation point
answered 2021-12-27T00:40:35.52+00:00
Rich Matheisen 44,621 Reputation points
1 answer One of the answers was accepted by the question author.

Service permissions to query or execute WMI commands on local machine.

I have a device I plug into a USB port which shows as a composite device in Windows, one of which is a network adapter. I am writing a service to detect this adapter and assign a static IP to it. I'm using WMI to do this, in \root\CIMV2, finding 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,411 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,191 questions
asked 2021-12-24T20:24:25.143+00:00
Robinson 156 Reputation points
accepted 2021-12-26T20:23:11.29+00:00
Robinson 156 Reputation points
8 answers

Performance problem in C#

I have a code-module in C#, which contains a loop with math. operations. At the end of each execution of the loop I get the UTC-time in milliseconds and store this by writeline() in a protocol-file (for example 200 lines at all). When the code-module is…

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,191 questions
asked 2021-12-23T22:10:37.173+00:00
Hans-Peter Bittner 116 Reputation points
answered 2021-12-26T16:30:55.437+00:00
Hans-Peter Bittner 116 Reputation points
1 answer One of the answers was accepted by the question author.

Why it's taking 17-18 seconds to download image ? each time it's taking 17-18 seconds.

The class Radar using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Extract { class Radar { public List<string> links = new List<string>(); …

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,820 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,191 questions
asked 2021-12-26T12:47:21.547+00:00
rhodanny 166 Reputation points
accepted 2021-12-26T15:34:49.837+00:00
rhodanny 166 Reputation points
1 answer One of the answers was accepted by the question author.

I copy a unit test in c#. However an error is found.

Dear All, I copy a unit test in c# from YouTube (https://www.youtube.com/watch?v=HYrXogLj7vg). See the screen captures. Could anybody tell me how to fix it?

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,191 questions
asked 2021-12-26T09:50:05.33+00:00
BenTam 1,541 Reputation points
accepted 2021-12-26T13:46:21.44+00:00
BenTam 1,541 Reputation points
3 answers One of the answers was accepted by the question author.

Index of control is -1 in C#

Hi, I am trying to get the index of a textbox control in WinForms, so I am using this: var index = Controls.IndexOf(textBox24); MessageBox.Show(index.ToString()); Now when I run the app, and click on the textbox, it shows the index as -1. Why?…

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,191 questions
asked 2021-12-15T17:14:06.123+00:00
Hemanth B 886 Reputation points
accepted 2021-12-26T04:41:02.587+00:00
Hemanth B 886 Reputation points
7 answers

Get the ElementFromPoint (IUIAutomation) from the 2nd scaled monitor

Hello, I'm getting the wrong IUIAutomation element from the 2nd monitor, if use it in a browser window like edge (which is not the main monitor and has a dpi for i.e. 125% in the windows settings.) I tried a few things and can't find a working…

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,191 questions
asked 2021-11-27T12:04:38.343+00:00
youki 991 Reputation points
answered 2021-12-25T21:04:49.157+00:00
youki 991 Reputation points
1 answer One of the answers was accepted by the question author.

Marshaling list string from C++ to C#

Hi guys, now i studying the way to marshalling list string in struct from C++ to C#. The structure of struct same like: In C++: struct A { wchar_t Name[24][16]; } in C#: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] …

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,191 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,516 questions
asked 2021-12-25T06:45:04.277+00:00
TaiDH 21 Reputation points
commented 2021-12-25T15:18:58.21+00:00
Viorel 111.7K Reputation points
2 answers

i can not connect mail server using tcpclient

i build a form to connect the mail servers using tcpclient withn port 25 but it does not start connecting to mail server any help please the problem in this code TcpClient connectserver = new TcpClient(); …

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,191 questions
asked 2021-12-24T22:49:31.87+00:00
sabry sabry 1 Reputation point
answered 2021-12-25T15:12:40.887+00:00
MotoX80 31,556 Reputation points
3 answers One of the answers was accepted by the question author.

Check if that DataBase is exist.

Hi All, What to do; Check if name of database is exist every time to create.Bellow some code I'm trying. Thank using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…

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,191 questions
asked 2021-12-12T03:28:18.657+00:00
MiPakTeh 1,476 Reputation points
accepted 2021-12-25T06:01:33.63+00:00
MiPakTeh 1,476 Reputation points
1 answer One of the answers was accepted by the question author.

I created a slider bar user control but at run time when I move the slider to the left or right why it's not getting to the end or swallow?

In the user control designer I added a pictureBox control : Then in the code I did : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,820 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,191 questions
asked 2021-12-23T20:38:31.857+00:00
rhodanny 166 Reputation points
accepted 2021-12-25T03:22:59.147+00:00
rhodanny 166 Reputation points
0 answers

How to submit selections to download file

Is it possible to write C# code to make selections i.e. date range to download a file? You can't see any of the controls under view source.

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,191 questions
asked 2021-12-24T22:44:45.087+00:00
MikeY1975 41 Reputation points
commented 2021-12-24T23:28:25.583+00:00
P a u l 10,401 Reputation points
0 answers

How to create RunAndSave Assembly using System.Reflection.Emit in .NET 6?

In the .NET 6 documentation for the AssemblyBuilder class in System.Reflection.Emit there is an example of how to build an assembly. The example can be made to compile and work in .NET 6 by changing AssemblyBuilder ab =…

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,191 questions
asked 2021-12-24T20:47:15.937+00:00
Nicholas Piazza 526 Reputation points
commented 2021-12-24T21:43:51.917+00:00
Viorel 111.7K Reputation points
4 answers One of the answers was accepted by the question author.

How to get original data before decryption ?

I work on csharp I need to get data before decryption but i don't know how to do that data decrypted on file as below : ˆU*o" ى,be~ùث »وچٍ­اàےي¾أ(هشْé Pشم¢×l. ZS’ى² N· ¾«é¬Q غتُ ’ذi,اGNِء”©¢¼î¨C2‡ ùu35Yôy ¾إ ً¼@پ6¹qv¹آœإûج 4 Hu؟¼إ‘{‏]…J î‚üد*ڈ…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,338 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,191 questions
asked 2021-12-13T00:07:07.967+00:00
ahmed salah 3,216 Reputation points
accepted 2021-12-24T20:44:26.507+00:00
ahmed salah 3,216 Reputation points
1 answer

missing logic to the LINQ query which does not work

public IHttpActionResult InsuranceLimit(InsuranceLimitDTO IL) { var result = from b in db.InsuranceTransferAcc where b.UserId == IL.UserId select b.CreatedDate; } This above query (result ) is returning me empty. Not understanding what I am…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,623 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,191 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,546 questions
asked 2021-12-24T08:54:58.617+00:00
Rock Hitman 46 Reputation points
commented 2021-12-24T19:43:35.92+00:00
Karen Payne MVP 35,026 Reputation points
1 answer One of the answers was accepted by the question author.

Is it ok to use HttpRequestMessage.properties in .net core 3.1?

Hi, I'm using HttpRequestMessage properties property in order to pass auth type in the request so that the message habdler will generate the correct authorization heade (basic, jwt, etc...) Is it good approach? Another thing I saw the Properties…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,133 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,191 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,117 questions
asked 2021-12-21T22:36:00.037+00:00
Nishi-nishi 21 Reputation points
commented 2021-12-24T13:47:03.11+00:00
Nishi-nishi 21 Reputation points
2 answers One of the answers was accepted by the question author.

A general class to manage threads

Dear All, I am a beginner in C#. I want to create a class which can insert into any project for managing threads. However I don't know how to do it. Could anybody help me?

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,191 questions
asked 2021-12-22T14:45:54.673+00:00
BenTam 1,541 Reputation points
accepted 2021-12-24T09:59:29.217+00:00
BenTam 1,541 Reputation points
0 answers

How do I set DBF column value to NULL (blank) when using VFPOLEDB and C#?

I have created a WPF application that is to maintain existing DBF files. These files are also used by another legacy application so I cannot migrate the data to SQL server or other more current DB. Some of the DBF tables have columns whose values are 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,191 questions
asked 2021-12-23T23:55:06.11+00:00
Leo Ayala 21 Reputation points
commented 2021-12-24T08:06:47.013+00:00
Viorel 111.7K Reputation points
2 answers

LINQ Query for checking Time duration

I have a sql table which has column as below I want to have a LINQ query to check, when InsuranceID is passed as a input parameter, the logic needs to check for that particular InsuranceID if the CreationDate is >24 hrs return as True else return…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,623 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,191 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,546 questions
asked 2021-12-22T23:32:06.757+00:00
Rock Hitman 46 Reputation points
answered 2021-12-24T07:58:04.15+00:00
Jack J Jun 24,276 Reputation points Microsoft Vendor