Questions tagged [c#]

C# (pronounced "see sharp") is a high level, statically typed, multi-paradigm programming language developed by Microsoft. C# code usually targets Microsoft's .NET family of tools and run-times, which include the .NET Framework and .NET Core. Use this tag for questions about code written in C# or C#'s formal specification.

0
votes
0answers
5 views

Create Observable.FromEvent by converting custom event handler to a delegate compatible with the underlying .NET event

I want to create an observable from event by converting my custom event handler to a delegate compatible with the underlying .NET event. I tried the example provided in the documentation https://docs....
0
votes
0answers
7 views

POS POLE Display- how to scroll contents horizontally?

In my pos application i want to show the total amount and selected items on the pole disply. i have a 2x20 character pole display. i want to scroll the item names through second row of pole display ...
0
votes
0answers
10 views

I created one Stored procedure getting Begin syntax error

I created the One stored procedure. Below is the query. I am getting Begin syntax error. CREATE PROCEDURE Upload_Address @COM_Addresstbl AS BEGIN SET NOCOUNT ON; INSERT INTO ...
1
vote
0answers
4 views

Framework.net service, using ConfidentialClientApplication and the Outlook Tasks REST API, got StatusCode: 401, ReasonPhrase: 'Unauthorized'

Hello World ! Hello to everyone ! I'm new to StackOverflow, so I'll do my best to explain my problem better. The Issue I'm tring to interact with Outlook Calendar and Tasks REST API from a c# .net ...
0
votes
1answer
9 views

How can I create an instance of IConfiguration locally?

I'd want to ask how to create an instance of ASP.NET Core's Configuration, the same that's being created when I require it in Controller's constructor which knows about the appsettings.json file like ...
1
vote
0answers
14 views

Forbidden 403 - Only on 1 function

I am currently deploying my web application to a webserver with HTTPS certificate. The app works correctly on the server and also outside it's local network. Except for 1 function, which returns. ...
0
votes
0answers
7 views

Lost reference of object after select type of element [duplicate]

I have web application in ASP.NET Core 2.0. I am working with two models: Event and EventPermission. Event has ByUser, title, descriptions and other columns... Just information. EventPermission ...
1
vote
0answers
15 views

How to make my app notification listed in windows 10 notification list?

I use below code to show notification in my Winform application. It shown but it dos't listed in notification list. var notification = new System.Windows.Forms.NotifyIcon() { Visible = true, ...
0
votes
0answers
7 views

Outputting 'SUB' character in CSV file when mapping from XML in XSLT map

Our customer wants a 'SUB' character at the end of the CSV file, for the receiver to correctly process the file. I've received in Excel document, where the character is displayed correctly. I've ...
0
votes
0answers
10 views

Data from partial view not posting

I have the following page : <form method="post"> <hr /> <h4>Alert</h4> <div class="card-overview"> <div class="card-columns"> <partial name="_Alert" ...
2
votes
0answers
15 views

Why ReSharper doesn't add NuGet packages when it suggests to reference them?

I'm working on a solution that has multiple C# projects. One of these projects already uses a NuGet package (e.g. Newtonsoft), correctly declared as such in the packages.config file and in its csproj ...
0
votes
0answers
10 views

How to draw pixel length on tabPage and MouseMove Show location

I try to use draw 0| | | |10 like these on tabPage. like photo below. The length and Width is depend on img I put in. So far I aready put backgroundImage to describe. If my background is load 800*...
0
votes
0answers
11 views

ZIP File Invalid Or Corrupted

Reading binary data from web response generates an invalid ZIP archive file. Can someone identify any issues with the following code? using (HttpWebResponse httpResponse = (HttpWebResponse)webRequest....
0
votes
0answers
22 views

Connection problem when changing password

I have a software which displays some tables from our SQL database. Now I want to add a tool, where I can change the password for my "testdummy" user. I tried to open a connection again but it didn't ...
0
votes
0answers
10 views

Get Properties with specific Attributes (Just-in-Time compiling)

My task is to find properties with certain attributes out of .cs files. So I get .cs files and I have to search them for certain attributes and save them in XML. So every propertie with the attribute ...
2
votes
0answers
14 views

Design for user-defined condition-based actions on a (data) object

I have a class with (nested) properties that define the configuration of a physical real-world object. For confidential purposes I can't show actual code, so assume it is a vehicle (car). public ...
-6
votes
0answers
13 views

How to create Numbers Jagged array Matrix using Excel and C#? [on hold]

How to create Numbers Jagged array Matrix using Excel and C# Like This : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 I want to specify The Number ...
0
votes
0answers
5 views

How to display non-spatial mysql data within or alongside google map (Geo)Json rendered file

I am trying to render data to a google map in the form of Polygons representing districts. The real issue I have is passing a data c# object (taken from mysql) to the javascript where the maps ...
0
votes
1answer
21 views

I want to convert ApiController

I need to convert ApiController to Windows Forms so I can use it there? Any suggestions how can I do that? public static async void sendPushNotificationApns(ApiController controller, Message ...
0
votes
0answers
11 views

How to change the source of an iFrame from a timer tick event

I have an iFrame on an aspx page. Inside that iFrame I'm trying to cycle between different pages depending on some logic. Its part of a 2 factor authentication system where users are sendt a bunch of ...
0
votes
0answers
9 views

Telerik RadComboBox Index was out of range error when

I am using Telerik component in my asp.net web application, below is the error I am getting Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: ...
0
votes
1answer
19 views

What is the equivalent of Math.Round() with MidpointRounding.AwayFromZero in Delphi?

How do I use c# similar Math.Round with MidpointRounding.AwayFromZero in Delphi? What will be the equivalent of: double d = 2.125; Console.WriteLine(Math.Round(d, 2, MidpointRounding.AwayFromZero)); ...
0
votes
1answer
31 views

Converting maxValue of DateTime to DateTime [duplicate]

string date1 = "31.12.9999"; Convert.ToDateTime(date1); if i run code above i always get error System.FormatException: String was not recognized as a valid DateTime. Is there a solution how to ...
-3
votes
0answers
16 views

Which library gives access to the browser enabled tab? [on hold]

I want to parse information from tab of existance browser. Like a Selenium WebDriver, but from browser which i`m working now, can i do it with complete library?
0
votes
0answers
17 views

How to use a bind property as a parameter in a View Model method

I have a view model in Xamarin Forms using Prism framework. I have a lot of UI elements that have, each, lots of bind properties in my view model that have similar behaviour. After a command action, I ...
3
votes
4answers
42 views

Returning value from out modifier to a collection in C#

Let's suppose I receive a collection of strings from user. I need to convert them to GUID sequences for further processing. There is a chance, that user may enter invalid data (not correct GUID ...
0
votes
0answers
5 views

EF BulkInsert doesn't honour SQLProviderServices setup

Possible XY problem: I need my code not to truncate decimals when writing to the Database. See here: https://entityframework.net/knowledge-base/26392489/entity-framework-code-first-truncating-my-...
2
votes
1answer
19 views

Create unique constraint on column

I have this model public class Record { public int Id {get;set;} public int Client {get;set;} public bool IsActive {get;set;} } I want to create a constraint for the IsActive column. ...
-1
votes
0answers
12 views

Insight on certain attributes about a process thread

I would like to view the file location and type of the thread like a createthread or createprocess and name of the thread with the console my current solution is Process proc = Process....
0
votes
0answers
6 views

In ubuntu OS when i try to upload file, automatically project root path added by own

I' try to upload file from .net core application, it is working fine with windows OS, but when i try to run a.net core application in ubuntu OS, In this while uploading file in perticular folder, ...
0
votes
0answers
9 views

No persister For: Error while Saving data using fluent hibernate

i am trying to save data into my DB table using fluent hibernate but its giving me "No persister for:". i tried many solutions available on net but nothing help me to get out from this situation. Can ...
0
votes
0answers
14 views

EF Core with inheritance and mapping: how to query and map a SQL view with inheritance

I have an old MySQL table that I scaffolded with Entity Framework Core (2.2), using Pomelo. I had to create an SQL view to list all users simulating an inheritance with a discriminator column. So I ...
0
votes
0answers
8 views

Image gallery using matrix RDLC

I have collection of image and i want to create image gallery this is my current .rdlc design which is repeating only on row in horizontal or vertical direction and then it drops to second page of ...
0
votes
0answers
16 views

How to display selected item in ComboBox when OwnerDrawn?

I'm cusom drawing a combobox and I have overriden OnPaint and OnDrawItem. So far everything works fine. However, after I select an item from the list and the list closes, the selected item is not ...
1
vote
0answers
14 views

ASP.NET Core Web App log 404 requests as warning

If I create a new ASP.NET Core Web App (Model-View-Controller) with dotnet new mvc it has already logging configured out of the box. However, http request error codes are logged as info event. info: ...
1
vote
0answers
21 views

Include self referecing elements on included property

I have a model structure as follows: class A { public ICollection<B> MyProperty { get; set; } } class B { public ICollection<B> Childs { get; set; } } Now I want to include ...
0
votes
0answers
31 views

ComboBox. Select item

Load items to ComboBox private class ItemWorker { public int Id { get; set; } public string FullName { get; set; } } bindingWorker.DataSource = model.Workers .Select(x => new ...
0
votes
0answers
14 views

Observe and delete (screenshot), if a screenshot is taken while using my App in Iphone

I am trying to observe if a screenshot is taken while using my App on Iphone. If a screenshot is taken while using my App, I would like that screenshot to be deleted. I also understand that during ...
-2
votes
0answers
31 views

Object Reference error when setting the Session [duplicate]

Currently, I am developing a website, Honestly, I am new to this and my code this the null reference error. is there anything wrong. [WebMethod] public string loadApplicantAccount(string email, ...
1
vote
0answers
17 views

Add html attribute to model class

I'm trying to add html attribute autocomplete to my input fields which are generated from my model class properties with @Html.EditorForModel(). Is there a way to add an attribute directly to the ...
-5
votes
0answers
32 views

How to create a Regular expression in C#.net [on hold]

Can any one help to create a Regular expression in below format. 1) Minimum length 8 characters 2) should contain characters from three of the following four catagories a) Uppercase (A-Z) b) ...
0
votes
0answers
31 views

How do we create a REST API with only IP and Port?

I have a Service fabric solution with REST APIs created. Now I have a need which requires one of the API to be accessed with only the IP and the Port. Example : http://23.XX.XXX.12X:8004 - how to ...
0
votes
1answer
9 views

Player-obstacle collision in Unity

I need to create a simple script which disables movement when the player collides or crashes into an obstacle. I've written this script in visual studio: using UnityEngine; public class ...
0
votes
0answers
8 views

302 Redirect to Login Provider response

I am using ASPNET Core Web API 2.3 and an external OpenId Provider. I want my API to return Status Code 302 and the Location that is redirected to in the HTTP Header. I need my app (which is a ...
1
vote
1answer
29 views

Read CSV file to nested objects

I have CSV file like Title|Column|Value A|Z1|1 A|Z1|2 A|Z1|3 A|Z2|1 A|Z2|5 B|Z3|4 B|Z3|6 .... I want to read this csv file into the following class hierarchy: (I want to end up with a List of ...
-2
votes
0answers
23 views

How do I send a “flag” from a raspberry pi to a C# program running in another computer? [on hold]

Basically, I have a motion sensor connected to my Raspberry Pi set up. I want to implement the solution such that when the motion sensor detects motion, it sends a "flag"/"signal" from the Raspberry ...
-3
votes
0answers
34 views

Creating a push button in windows forms using C# [on hold]

How to create a "Push button" in the windows forms? The button click is associated with a change in the value of a boolean variable. The boolean variable should be true only when the button is long ...
0
votes
0answers
5 views

Determine the SymStore hash for the pdb matching a dll

I'm currently setting up some build infrastructure and as part of this process a .NET solution gets built and the symbols are stored in a SymbolSource server. I want to be able to test that Visual ...
0
votes
1answer
17 views

PInvoke only works in 64 bit, when returning a struct [duplicate]

I have the following C++ code, that compiles to a dll: typedef struct _RGB { unsigned char R, G, B; } RGB; extern "C" __declspec(dllexport) RGB __stdcall TestMethod1() { RGB rgb{1,2,3}; ...
0
votes
1answer
34 views

Calling Stored Procedure in Entity Framework Core with parameters not start with @ or #

I'm writing a data layer based on ef-core 2.2, which need to be compatible with SqlServer and Oracle. When calling a SP with complex data format (like binary) or output parameters, a SqlParameter ...