C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

βœ… Catching keyboards from Remote Desktop Session

Hello I've tried to catch keyboard events from Remote Desktop Session opened. It worked when window mode, but when I make it full-screen, key catching didn't work. How to solve this problem? Regards....

βœ… My program can’t be run.

I got a problem when I run my program. .NET SDK version: 8.0.403 Mac OS X OS version: 14.5...
No description

WPF TreeView Fails to load ItemsSource

The control ``` <UserControl x:Class="XMLViewer.Features.XMLViewer.XmlViewerComponent" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"...

fastest way to check if list doesn't contain null ?

I have a list of reference type (for example, list of string) as constructor parameter. Now i require that all of the list element must not be null. Everytime the object instance is created, the constructor will loop through the list to verify that none of the element is null. However, this have performance impact to immutable class where any modification require creating new instance of the class (because immutable class can't be modified). Is there faster way to check that list element cannot...

having problems with random number generator in uni project

I was given a small assignment for a bit of uni project to make a program that generates a random number then asks you to guess. The problem is that after each guess the number gets randomised again, can someone help (I’ve tried putting it outside of any loops and it still does this)
No description

[WinForms] Need ideas/help where to start..

Hello im a first year CS student and its our 4th week of C# I've given a project in C# to do a small internet cafe management-like project Basically it should be done on WinForms. ...

i cant load data from DB to dataTable

Link to my github: https://github.com/buison1602/BulkyWeb_.Net_Core_MVC/blob/master/BulkyWeb/wwwroot/js/product.js Error: jquery.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at S.fn.init.data (jquery.min.js:2:34508)...

Number of projects in Visual studio

How many projects can a single Visual Studio solution contain? & Why?

Efcore - Database issues (Sqlite)

Hey I am getting this error code when I am attempting to do a method in my application. (Domain Driven Design) - MediatR - Domain Events. I can send code snippets if it could help with debugging....
No description

How do you implement paging on API requests?

Basically title. Do you implement it by yourself or do you use any nuget?...

Named function magically turns into anonymous method for no clear reason, cannot be used as Action

I am storing a list of delegates, which are added via calls to DefineFunction(string name, Delegate actualFn). I have a method with signature public void DrawSprite(string sprite, float x, float y, float w, float h, float rot, float grayscale01 = 0). But when I call DefineFunction to add this method to the list, for some reason, DefineFunction takes it in not as a System.Action or System.Func derivative like every other call, but as an <>f__AnonymousDelegate0 type, which cannot later be converted to a System.Action for invocation. ...
No description

[WinForms] Need help optimizing custom controls creation/updating of ui

I have custom controls that is being dynamically created based on data from several API calls. These controls are being created after the processing of data is finished. There were no issues from API calls/mapping of data since I can see that the custom controls are being created immediately after opening the form but the problem is updating the data on the UI. It takes several seconds for the UI to get updated and it gets slower the more controls there is. I have used SuspendLayout/ResumeLayout/PerformLayout before for updating a certain Custom Control, but I want to increase the speed on how the UI gets updated. This is the flow: 1. Click button to open the form 2. Parent Form gets created and creates some other UI control...
No description

WPF - Binding json data into datagrid and datagrid updates during runtime

Hey guys, I have attached screenshots here to help understand what im trying to do. so in my json file theres a bunch of usernames that are already there and during runtime i will want to add and delete logins (as the admin staff can do that). my issue here is that im trying to make the data grid output that data and read everything from the json file but i dont know the actual code for that in my XAML and cs. i tried the itemsource binding syntax but that didnt seem to work (o maybe it does bu...
No description

Need help finding a library for a specific job

I need a library that has a english dictionary that allows me to search through it for a word meeting specific criteria like how many of a specific letter it has.

Not a function? Service

Hey guys , I've gotten an error and I don't know why. I triple checked my variables but still getting an error. ``` app.service("MachineProblemService",function ($http) { this.staticConnect = function (userEmail, userName) {...

Setting a Default Value for Migrations

I have a relationship between two models but the relationship is not required, i.e. the first model which "belongs to" the other model can exists on its own. ``` class Item { ...

βœ… Winforms not freeing memory when disposing of control

```csharp void NewButtonOnClick(Button btn) { //Delete the button completely, write code btn.Parent.Controls.Remove(btn);...

βœ… SMTP server broke

We used to be able to connect using SMTP outlook.office365.com 587 but all of a sudden it no longer will connect. Error ``` The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [MW4PR04CA0249.namprd04.prod.outlook.com 2024-10-16T23:46:33.247Z 08DCEE0C14048537]...

MVVM Toolkit Messenger - RequestMessage

I have no idea why one of the methods is never executed... take a look at this vs Messenger
C#
public class AsyncRLoginMsgReq : AsyncRequestMessage<bool>{};
C#
public class AsyncRLoginMsgReq : AsyncRequestMessage<bool>{};
```C#...