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
8 views

SQL INSERT statement is not executing but I am not receiving an exception either

On my button click event I am just wanting to insert a row into a table. When i click the button i get no exception and i also don't get my messagebox to show either. I have the messagebox as a way to ...
0
votes
0answers
2 views

Xamarin.Forms iOS CursorPosition not being honored

In my Xamarin.Forms app, I have a behavior that sets the cursor's position (the behavior acts as a mask for our input field). The CursorPosition is set by calling: targetEntry.CursorPosition = ...
0
votes
0answers
3 views

How can I add a textbox that searches all ToolStripMenuItem and only displays the ones that match?

I have a personal productivity tool I created to help automate as many tasks that I complete regularly as possible. It's visually represented by a NotifyIcon that displays the options in a ToolStrip ...
0
votes
0answers
6 views

Why is my foreach Loop Only Processing Every Other One?

I have a button on my Win Form that goes through each row in my DataGridView and calls another function as needed. The loop and function work, however, it seems to be skipping rows. I selected 6 ...
0
votes
0answers
3 views

is it possible to get the xpath for the current node within xmlreader?

Is it possible to get the xpath of where I am in the loop currently? var rdr = XmlReader.Create(new StringReader(input)); while (rdr.Read()) { if(someCondition) {//...
0
votes
0answers
3 views

Windows Service app with C# and HidSharp to read USB barcode

I need to make an C# application to catch a barcode read with a HID USB Barcode Scanner. This application must run without user interaction. I thought on a Windows Service because it starts ...
0
votes
0answers
3 views

How to ensure a thread change when doing async/await?

When doing await the Task could or could not be executed on the same thread. Usually, we just need to take this fact into design consideration. But I would like to do a test specifically for the ...
0
votes
0answers
6 views

How to add colliders to complex maze

I downloaded a maze sprite for expiremental purpose to use in my game and I'm trying to add colliders to the wall. But since the maze is complex, it is quite a lot of work to add a Box collider 2D to ...
-3
votes
0answers
10 views

can you help me for this error in C # on unity 3d please [duplicate]

I have this error and I do not understand why NullReferenceExeption: Object reference not set to an instance of an object EnemyAI.Update()(at Asset/EnemyAI.cs:52) I have this error on this line of ...
0
votes
0answers
9 views

Return two lists to view

I'm trying to return two lists to my view, these lists help me fill some webgrid, I searched the web and I can not find a solution, I'm new to this My Controller public ActionResult Index() { ...
0
votes
0answers
8 views

Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on in window form

I have 2 form in my window form application frmDashboad and frmCompany. There is a button on frmDashboad form, and on click of that button I'm showing frmCompany as a Dialog. This is my code. ...
0
votes
0answers
6 views

Can't make a prefix appear in XMLDocument even if I force it [duplicate]

I'm building an XmlDocument that has to be validated against an XSD given un by committer but can't make a prefix appear and so validation fails. Validation with Notepad++ throws this error ERROR: ...
0
votes
0answers
9 views

Unity - Blend Skybox Materials

I purchased an asset package called Polyverse Skies. Its really nice the created used Amplify Shader to make a nice little package. Inside the folders he has material presets for night and day. Now I ...
-2
votes
1answer
36 views

Cast double to String within a Lambda expression

I' getting the following error message when trying to read a DataTable into an IList<T>.: System.InvalidCastException: 'Specified cast is not valid.' I'm a total newbie to lambda ...
-1
votes
1answer
23 views

How to prevent char repetition on name and surname with regex in C# model for validation field

I'm trying to put a regular expression on my table model to validate name and surname in same form field, when: 1st Name must be at least 3 chars. 2nd Surname must be at least 2 chars. 3rd name can'...
0
votes
0answers
21 views

How can I map lists of simple datatypes without having to stringify them?

I'm making a API in C# .NET Core 2.2 and I'm trying to figure out how to properly map Lists of Enums and Strings. Right now I have the following solution: [NotMapped] public virtual ...
0
votes
1answer
35 views

Days difference between c# and sql server

I have the following code in c#: var days = (result.PasswordExpDate.Value - DateTime.UtcNow).Days; result.PasswordExpDate has a value of 5/25/2019 4:49:37 PM DateTime.UtcNow has a value of 5/24/2019 ...
-1
votes
1answer
16 views

How to create an XML file of an object

I am working on a word recognition in automata, and for the exchange of information I need to create an XML file of my object. already use the library using System.Xml.Serialization; [Serializable] ...
0
votes
0answers
11 views

Admob TestAds dont't show up on device

Admob's Test ads wont show on any of my test Devices but log that they are loaded in the Unity Editor. I have resolved the android dependencies and I will show my Manifest and AddCaller and I have ...
0
votes
0answers
16 views

How to convert a drawing group to a single static drawing or drawing image?

How to convert a drawing group to a single static drawing, image or drawingImage that has performance equivalent to a single drawing geometry Drawing. I have tried to draw an ImageDrawing using group'...
0
votes
1answer
16 views

Enable sharding from C# MongoDb

I'm using Mongo 4 with the latest C# driver. My application creates DBs and Collections on the fly and I want to enable sharding. I'm using the following code: if (!ShardingEnabled) return; ...
0
votes
1answer
30 views

How do I exclude a dependency of Microsoft.NETCore.APP

How do I exclude a dependency of Microsoft.NETCore.App so I can replace it with a locally compiled (bugfix) version. I carried out the normal procedure for replacing a package by making one with a ...
0
votes
3answers
38 views

Reading JSON data in groups

I have JSON data (households with their cars) which I am trying to read JSON data. A subset looks like this: [ { "car":[ "Honda Civic", "Toyota Camry" ] }, { ...
1
vote
0answers
23 views

Is there something similar as SqlBulkCopy in VBA (Excel)?

In C# I use System.Data.SqlClient and do something like code below. Is there something similar in VB (Excel)? { static void InsertDataIntoSQLServerUsingSQLBulkCopy(DataTable csvData) ...
1
vote
2answers
26 views

Use one Function for the mutliple Buttons & Values

I am programming an application to get my color management done in a better way. Therefore I am using WPF and C#. Now I created 5 Rectangles that should display the color that you can enter ...
-2
votes
0answers
80 views

C# - Why can’t one type cast int* to int[]

My Goal: In the situation below I am trying to store the address of a int array into integer pointer variable and then convert that pointer back into an integer array. My Question: After running the ...
1
vote
0answers
13 views

DbUpdateException when removing object of a self referencing class

I'm currently developing a system that generate and manage thumbnails for images in a site. Basically to improve loading time, creating smaller images before so it doesn't need any preprocessing for ...
0
votes
1answer
18 views

TimeZone Issue while Rendering in MVC

I am working on a requirement where I will save the Date of Submission value of a customer. It works perfect. But the problem is, when I fetch that data related to customer and rendering it in the UI, ...
0
votes
0answers
6 views

Adding role to context

I have the following code which working fine for authentication // POST api/Account/AddExternalLogin [Route("AddExternalLogin")] public async Task<IHttpActionResult> ...
0
votes
0answers
7 views

How can I get detailed info on what Bot Connector Service does to messages sent from registered channels to my endpoint?

I'm using MBF for its channel integration with Facebook Messenger. During development I've been using "ngrok" in order to debug directly sending and receiving messsages from Messenger. After reaching ...
-1
votes
0answers
21 views

How to perform an action at specified date and time intervals in winform application

In my winform application, it will need to perform a certain action on specified intervals, lets say every First Tuesday of each month at 3 am. What's the best way to achieve this? Timers? Task ...
0
votes
0answers
9 views

Why can't I connect to my USB Composite Device with HIDSharp?

I'm working on a project that emulates a USB Composite Device consisting of a HID keyboard and HID Mouse using a microprocessor. I have the device properly enumerating and functioning with both my ...
0
votes
0answers
5 views

pdf downloaded from web service to cordova app is corrupt

I have a cordova app that requests a file from a web service. The service gets the file and uses the following c# code to convert and send it back: byte[] bytes = System.IO.File.ReadAllBytes(filepath)...
0
votes
0answers
14 views

Starting client console app through Startup class

I'm writing a client-server app with client part in console application and a web api application as a server. How can I trigger launching client console app in my Startup class (inside web api ...
-1
votes
0answers
12 views

How to Store API Response in Model Class and Bind to Database?

I'm using RestSharp to send requests and receive responses from a payment gateway API. I'm not sure how to store the API responses in my database table upon receipt. Here's what I've written thus ...
0
votes
2answers
32 views

How to make label reappear as soon as it's going out of panel width

I want to make a moving label seem nicer and smoother than just reappearing the whole thing to the left after it has all gone out of panel width .For example label 'Hello' , as soon as 'lo' goes out ...
0
votes
0answers
16 views

MinWidth property of MainWindow is binded but doesn't work - how can I get it done in MVVM and using settings class?

I am preparing simple app and when I click button to show some additional info, I would like the width of Main Window to grow. And it works but at the same time I would like to set it's MinWidth ...
1
vote
1answer
11 views

WPF XceedDataGrid use datatrigger to collapse/Hide rows

I am using the DataGridControl from the xceeddatagrid library(http://schemas.xceed.com/wpf/xaml/datagrid). What I am trying to do is hide/Collapse the datarow based on a property from the class model. ...
-4
votes
0answers
22 views

install .exe file on windows pre defined path

I have a windows application that I am building in C#. I need to explicitly install this application into a defined path like the %APPDATA% or %PROGRAMFILES% folders. I don't want this app installed ...
0
votes
0answers
38 views

How download file using .net and angular 7

I have different files on my server and I try to download some of them. It has different names and extensions and I can't hardcode them in my code. How I can download such files? I'm using .Net core ...
-1
votes
1answer
16 views

How to use breakpoint for debugging in other solution

I have a web application in .netcore, I have two Solution and from one of them I have just a class library and create nuget package from that, from another solution I used that nuget package in it and ...
-5
votes
0answers
22 views

How to Display image from database which is of the type bytes using stored procedure? [on hold]

i have been trying to insert image into database as bytes using stored Procedure and to display.I couldnt find the solution .Somebody please help me with this.I am using Stored Procedure. [HttpPost][...
-1
votes
1answer
17 views

C# XML Deserializing No Errors

I am currently trying to deserialize an xml string to a C# object. I am getting no errors. Just nothing ends up in the list. The XML is contained within a URL. I have used A xml to C# object ...
0
votes
1answer
28 views

How can I generate a List<KeyValuePair<string, int>> consisting of groupings from another list?

I want to make a List<KeyValuePair<string, int>> with contains zip codes and the number of people living at each location. The data is coming from another list, which is a List<Member&...
0
votes
1answer
22 views

Textbox not updating CanExecute

I'm working on an MVVM application that has a Save button that I'd like to disable if the Title field is empty. Here's the code for the delegatecommand: _clickSaveChangesCommand = new ...
0
votes
0answers
7 views

NHibernate compare local date year and month with collections of dates

What I would like to do is: tradingObjectQueryOver.Where( Restrictions .On<OrderDealDto>(d => d.UnderlyingContractMaturity.Value.ToContractName()) .IsInG(filter.ContractDates....
0
votes
0answers
20 views

self reference tree structure

I'm using C# with entity framework core and sql server. I want to model something like a composite structure but have some problems saving the structure in the repostiroy. This is the error I get: ...
0
votes
1answer
11 views

Change cell background color based on cell's text in excel using C# EPPlus

I am trying to change cell's background color based on its text content. Eg: for text = "In progress" it should be Yellow, for text ="Completed" it should be Green. Not getting any clue to proceed ...
-4
votes
0answers
42 views

How to convert Int type variable to List<int> in c#?

Suppose,two list are a and b. I was comparing if a[0] > b[0], the count_alice will be 1. Then I need to convert this int type count_alice variable to List type. How can I fix this? static List<int&...
0
votes
0answers
24 views

NameValueCollection into equivalent javascript

I have a c# code that uses NameValueCollection, and then webclient to send a post request to API. I need to use an equivalent request but using javascript instead of c#,I tried more than one way but ...