Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
0
votes0
answers43
viewsError making a request to an external API
I am trying to make a request to an external API but in the console appears the following error: Code in Jquery: $("#Compilar").click(function () { var codigo = $("#CodigoText").val(); var clientId…
-
0
votes1
answer73
viewsdifficulty making Foreach lambda in a query
I have this query var qry = _productRepository.Table.GroupJoin(_categoriesRepository.Table, p => p.CategoryId, c => c.Id, (p, c) => new { Product = p, Categories = c.DefaultIfEmpty() })…
-
0
votes1
answer137
viewsmvc application with visual studio code, Connection Strings
I am using Visual Studio Code with the extension mssql on linux and need to get the Connection String from a database I’ve already created, but I’m not getting. The teacher of the course that I am…
-
0
votes1
answer100
viewsVirtual property is not instantiated in lambda
When I took a code to improve performance I had the following. A method GetAll() this method populated a var. It was made a foreach in this var and was assigning the appropriate values. It happens…
-
0
votes1
answer94
viewsProblem searching (Firstordefault) - Linq
I’m having a problem conducting the following search: var estDel = bdprincipalEntities.unidades .FirstOrDefault(x => x.uni_codigo == uni_codigo && x.Emp_codigo == Emp_codigo); the field…
-
0
votes0
answers45
viewsDatabase image does not load
Good morning, I’m trying to display an image previously recorded in a database in the form gridview, but this is returning an error and I can’t figure out what is wrong following the aspx snippet…
-
0
votes1
answer36
viewsAspnet Core - Failed to display date in form
I’m making a system to exercise aspnet core. In the system I have a record of Transaction, that is already working correctly, and at this time I am making an option to edit a transaction that was…
-
0
votes2
answers83
viewsJavascript function does not perform
I have a c# check that if it is true, runs the following javascript function: @{ if (!string.IsNullOrEmpty(TipoPecaController.MsgExcluir)) { if (TipoPecaController.MsgExcluir == "3") { <script…
-
0
votes1
answer158
viewsHelp with COUNT mysql and Asp Net Core
In my system I have a form for opening calls, in which each call has the following status: Aberto, Agendado, Em Atendimento and Finalizado. I would like to exhibit in home the amount of each one…
-
0
votes1
answer141
viewsError deserializing json
I have a little problem with deserializar mine json, and I don’t know why public async Task<IActionResult> Index() { Uri BaseAdress = Services.Token.BaseAdress; string strToken =…
-
0
votes2
answers63
viewsHow can I make a "tender" expression in a simpler way
I don’t know a good way to ask this, I googled it but I didn’t think what I wanted, I know the expression variavel?.atributo which makes the code only try to catch the attribute if the variable has…
-
0
votes1
answer42
viewsError trying to install Ntoastnotify package by Nuget
I’m trying to install the package: Ntoastnotify version 5.0.10 in my system: Asp.Net Core 2.1 But I’m getting the following messages: Severity Code Description Project File Line Suppression State…
-
0
votes1
answer46
viewsError returning a JS function
I’m trying to store an image with JS and is giving an error in return. Error message: VM85:8 Uncaught Syntaxerror: Illegal Return statement I’m doing it for Selenium with C, follow my code:…
-
0
votes1
answer259
viewsCheck if it is a list in c#
I have a method, where I will receive an object of any Class, and one of its properties can be a List that can be of a specific object or string, int, decimal and etc. My question is: How to…
-
0
votes1
answer69
viewsHow to pull data from a cell in the Data Grid?
My database data is showing up on a DataGrid and I wanted to make them go to the TextBoxs as soon as I gave two Clicks in the specific Cell for editing, how can I do it ? Detail, the database was…
-
0
votes1
answer47
viewsI cannot use the Firstordefault method on an Iwebelement type
I am unable to use the Firstordefault method with Selenium public IWebElement RetornaRegistro(string titulo) { var trs = _driver.FindElement(By.CssSelector("table tbody tr")); var alvo =…
-
0
votes1
answer278
viewsHow to change the function of my save button, to change
I have some data registered in the database, and I wanted to know how to change the function of inserting in the database to change the data, using a Button, I can pull the dice and throw them at us…
-
0
votes0
answers81
viewsProblem importing a . net framework project into a . net core project
hello, I’m creating a . net core application but I need to use a . net framework project. i can import it without any error but at runtime an exception is fired. The Exception says that it was not…
-
0
votes1
answer1137
viewsHow to take an input value and manipulate in Behind
Guys with a difficulty where I need to take the value of a text input and manipulate it in the aspx page’s Cs. I am using repeater to add the data to the table, but while trying to pull the input…
-
0
votes0
answers82
viewsInsert Image into an HTML file
I am creating an HTML file and need to insert an image that is in the Resources for this I am trying to use the following code: private byte[] turnImageToByteArray(System.Drawing.Image img) {…
-
0
votes0
answers96
viewsWin32exception: The network path was not found
I am getting the following error in my application that is hosted on aws Sqlexception: A network-Related or instance-specific error occurred while establishing a Connection to SQL Server. The server…
-
0
votes1
answer114
viewsFill a Checked List Box with SQL Server values
I am creating a form that I would like it to work as follows: First the user would select the type of exercise that would be played in the Checked list box using a Combo Box, then the bank would…
-
0
votes0
answers24
viewsProblems in Mapping with Fluent
I already had a resale table, where I had to add a new field. This new field is a FK of a new table that I created. Then we have: Reseller(Reseller) which receives a FK Discount. In Reseller this…
-
0
votes1
answer27
viewsParameterize with Restshap
Hello, I am trying to pass a POST to my Webapi using Rastsharp, but I’m having difficulty passing the parameters... RestClient client = new RestClient("http://localhost:18256"); RestRequest request…
c#asked 5 years, 7 months ago Eluander J. F. Lopes 400 -
0
votes3
answers337
viewserror calling a method passing a class as parameter c#
Good! I took part of a code that creates a user in AD with C#, the problem is when I call the method, I am beginner in programming, I will pass the code and the error. private static…
c#asked 5 years, 7 months ago Anderson User777 63 -
0
votes2
answers289
viewsAdd Object to a List with C#
My objects are apparently being added to my list, but when I call the list in update() it does not perform as expected. public class CenaCozinha : MonoBehaviour { //Os Alimentos public GameObject…
-
0
votes0
answers345
viewsHow to call controller method for a View
Nessa Dropdown <div class="form-group"> @Html.Label("Grupo de Desconto", htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownList("Grupo de…
-
0
votes1
answer49
viewsList error is null but I am filling
I have this Action in my controller [HttpGet] public ActionResult Details(AzureDiscountGroupModel modelD) { var discount = _azureDiscountGroupService.GetAll(); var list = new ResellerListModel();…
-
0
votes1
answer96
viewsNunit error log repeating exceptions - Multiple failures or warnings in test
I am using Nunit to run test scripts with Selenium Webdriver in C# (Visual Studio). The project uses the template Console Application. When running, the project displays a console (prompt) where I…
-
0
votes2
answers46
viewsLog datagridview data into a table in the database
Good afternoon, you guys! I have a problem with doing a data insertion presented to my datagridview. I have a table called Events, and it contains all my records, I created another table with the…
-
0
votes0
answers86
viewsDisable Identity Entity Framework temporarily at runtime
I need to synchronize 2 databases, One stays on the local machine and one on the server, I get the data I need by Api via Json, And it returns me the model with the data I need to insert.. However…
-
0
votes2
answers167
viewsFetch information from a td by jquery
I have within my system a kind of analysis table, where the client will check item by item filled in according to what the surveyor did. Inside this screen there is a section for Checklist, which is…
-
0
votes1
answer44
viewsEnter a screen with the dropdown option already selected
I got this dropdown <div class="form-group"> @Html.Label("Grupo de Desconto", htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10">…
-
0
votes2
answers144
viewsClear html content with jquery not working
I have this jquery <script type="text/javascript"> $(document).ready(function () { $("#GrupoDescontos").change(function () { $.ajax ({ url: '' + $(this).val(), type: 'GET', success: function…
-
0
votes1
answer55
viewsWindows Forms, double click that opens a new Form
I have a table called Tournament and would like to make Doubleclick on the type of game open all the teams of that game. I have 4 buttons that represent the 4 games I have, in the 4 games I have the…
-
0
votes0
answers42
viewsKeep redirecting the user until he completes a specific task
I’m developing an app to manage a condo. What I need is that after the user logs in he is redirected to the condominium registration screen (caso ele não tenha nenhum condomínio cadastrado ainda)…
-
0
votes1
answer31
viewsFileinfo.Length gives wrong size
I’m trying to add the thumbnail, the name and size of a file to a ListView. I can add everything correctly except the size! I’m making Split PDF and I will add the information of each page to the…
-
0
votes1
answer127
viewsI cannot create new class in the project - Visual Studio
I have a project where I created a new class using System; using Definitions; namespace CommunicationCheck{ public class CommunicationCheck { private message_struct Send; private message_struct…
-
0
votes0
answers33
viewsSession is lost after post with Fileupload - ASP.NET
I am using Fileupload in a register page of a logged area, but when the post runs my Session is lost. I tried using Updatepanel and it didn’t solve the problem. Other solutions that I tried and also…
-
0
votes0
answers56
viewsHow to know the size of an object in memory ? c#
Just to put it in context, I’m upgrading an image search engine and need to save the previous search to the session: public static void SavePreviousSearch(APIStandardSearchResponse search) {…
c#asked 5 years, 7 months ago Leonardo Bonetti 5,313 -
0
votes0
answers28
viewsDo not cache a View using Asp.NET
I have a popup that renders another View using the RenderPartial(). @Html.DevExpress().PopupControl( settings => { settings.Name = "pcModalMode"; settings.Width = 550; settings.Height = 420;…
-
0
votes1
answer200
viewsUndefined object reference for an object instance. '
Hello, In my code there is this error System.Nullreferenceexception: 'Undefined object reference for an instance of an object.', _oleCmd was null. How do I fix it? (I’m a C beginner#) using System;…
-
0
votes0
answers60
viewsIN() command in mysql with C#
Hello, I have a problem that I can not solve. I want to make a SELECT at the base using the command IN(@grupo). Where the @group is a string with the ids separated by comma Exp(1,2,4). However when…
-
0
votes1
answer177
viewsEncrypt password in.config app
Hello, people I am with the following situation I made an application and some connections I made via visual C# Only it created a file calling app.config with the connection information as below…
-
0
votes1
answer144
viewsHow do I connect a Heidisql database to Visual Studio using Report Viewer packages?
Follow the code of my comic book from Heidisql: CREATE DATABASE ProdPacote; USE ProdPacote; CREATE TABLE Produto( ID_Produto INT PRIMARY KEY AUTO_INCREMENT, Nome VARCHAR (200) NOT NULL, Descricao…
-
0
votes2
answers42
viewsHow to load Enum property into a Lambda
I own property like that public CustomerTypeRequest Type { get; set; } That guy(CustomerTypeRequest) is an Enum, as below public enum CustomerTypeRequest { Guest = 0, //Visitante anônimo Customer =…
-
0
votes0
answers37
viewsCreate user in AD by informing the C# Forms group
Good evening, everyone! I already have the code user creation in AD with LDAP, and now I want to create this user already informing the group, already researched and I haven’t found the solution…
c#asked 5 years, 7 months ago Anderson User777 63 -
0
votes0
answers30
viewsEF mapping with generic classes
I have a project that used Nhibernate with a generic/abstract class structure that was mapped without problems. the problem is that I was forced to migrate to Entity Framework and now I’m lost in…
-
0
votes1
answer131
viewsHow to place two Tables in a Datagridview?
I have a program in which I wanted to present two tables of my database in one datagridview, these two tables have relation of n to n but I don’t know how I can see the second table. Step to…
-
0
votes1
answer30
viewsView Progressring while loading data
I have a ProgressRingwhich must be displayed while a list of accounts is loaded into a DataGrid: <Grid> <ProgressRing x:Name="CarregamentoDeContas" /> <controls:DataGrid…