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
-
2
votes1
answer486
viewsManipulating the opacity of an object(control)
Example: At the push of a button I’ll display a painel editing only its visibility, it works, but is without any effect, is a dry transition. Then I had the idea of pressing the button to display…
-
2
votes2
answers811
viewsHow to close splash screen?
I developed a screen of splash for my application. It is working perfectly, it opens and directs to the Form2. But I realized that by closing the Form2, I have to stop debugging through Visual…
-
2
votes1
answer217
viewsCorrect way to update a Model from a Viewmodel
I have the following question: do I get one Viewmodel in the Controller of ASP.NET. In the update method I have two options: 1st option : transfer the Viewmodel to the respective bank entity…
-
2
votes2
answers468
viewsC# system integration with two web services
I have to create an application that plays the role of a "bridge" between two web service that store information. I have to take information from one and send it to the other the way this "other"…
-
2
votes0
answers112
viewsEdit XML via Treeview WPF Node - C#
I have a question, I have a code that creates a Treeview dynamically through a code c#. A TreeView was created in WPF. My goal is to create a function that opens an item XML and created a TreeView,…
-
2
votes1
answer574
viewsReceive and Send JSON C#
In a local application "Windowsform" in C#, I need to send and receive data via JSON to a PHP page, there is some predefined function for this ?
-
2
votes1
answer70
viewsEstimated travel time using dbgeography
It is possible to calculate the estimated travel time between two localities using dbgeography in C#?
-
2
votes2
answers94
viewsBindingsource among more than one class
I am developing a system in C# windows form where I have my classes developed according to my database. My problem is that I am not able to make my Bindingsource list in a Datagridview the query…
c#asked 9 years, 1 month ago Self-Murder 21 -
2
votes1
answer49
viewsStatic does not share values between web users
It is possible to use a property static without sharing values between different users? Sort of like Session? Ex: of the scenario: private static double valorRetorno; public CalculaValor() {…
-
2
votes1
answer334
viewsWhy are you saying this object is null?
papelX.moderador = abc.Id; papelX.participantes.Add(abc); I’m finding a NullReferenceException in that code above. I’m creating an object papelX and I will use some properties of the object abc.…
-
2
votes1
answer122
viewsEdit two tables simultaneously in an "Edit" view
I have two tables: Pessoa and Catequizando, with a 1:1 ratio and want to make a "Get" to the data of the two tables, both "id s" are equal, so I did the Catequizando catequizando =…
-
2
votes2
answers286
viewsConvert an Ipaddress to string
This code retrieves the gateway standard, but I can’t convert the result to string and put on a label. public static IPAddress GetDefaultGateway() { var card =…
-
2
votes3
answers185
viewsUpdate to 2 tables
I cannot update the 2 tables. The problem is here. db.Entry(catequizando).State = EntityState.Modified; db.Entry(pessoa).State = EntityState.Modified; db.SaveChanges(); Some solution? Controller:…
-
2
votes0
answers103
viewsLogging, Registration, Permissions C#
Guys I would like to know in a logical and robust way and very clear, how the organization behaves in a software that will possess: -Logging (any and all actions performed on the system must be…
-
2
votes4
answers582
viewsEntity Inner Join in LINQ
I wanted to make an Inner Join so that I get a list of the names of Logins from the Integer List of UsuarioID class LoginsAtivos. public class Login { public int ID { get; set; } [Required] public…
-
2
votes2
answers69
views -
2
votes1
answer59
viewsHow to block an Pivot?
On Windows Phone, we have the Pivot structure, which has the Pivotitens, which are tabs (screens) on which the user just navigates by sliding his finger left or right. I’m making an app and…
-
2
votes2
answers817
viewsI can’t implement a @Foreach on MVC
I’m a beginner in ASP.NET MVC development and I need some help. I’m having trouble creating a Foreach. Follow my code below. @foreach (var item in Model.Fornecedores) { <tr> <td>…
-
2
votes1
answer495
viewsTask.Run locking inside a "tick" (Forms.Timer)
In my application, I created a "Timer" (System.Windows.Forms) that runs every 1 second. In the "tick" event, I placed a await Task.Run. For some reason the tick stops running after a while (because…
-
2
votes1
answer466
viewsMapping of Associative tables with Entity Framework
I have the following problem: A client has tasks for each day of the week. Example: Client A - Saturday - Wash Car, Clean House... Map it as follows: public class Cliente { [Key] public int Id {…
-
2
votes1
answer521
viewsGet child tag reference from XML C#
XML: <?xml version="1.0" encoding="UTF-8"?> <clientes> <cliente> <nome>Cliente1</nome> <contatos> <contato> <nome>Contato1</nome>…
-
2
votes3
answers198
viewsController with Repository, Ioc and DI
I’m trying to implement the recording of my views, Usuario repository in my controller, even using dependency injection examples, because in my user’s repository constructor it expects to receive an…
-
2
votes1
answer493
viewsEntity Framework: Error creating the database
I am using EF6 and I have a problem using the command Update-Database -Verbose -Force. From the following error: PM> Update-Database -Verbose -Force Using StartUp project…
-
2
votes2
answers1158
viewsRemove specific data on a stack
I have no idea how to remove a specific data from a stack. I tried to perform the minhaPilha.remove(); and nothing went right. Console.WriteLine("<Pilha>"); Stack<string> minhaPilha =…
-
2
votes1
answer516
viewsFill in Combobox
In a User Registration Form, I have a combo box UF (which loads the data from an sql table), when writing in Combox the system needs to go searching the data and presenting despite those that…
-
2
votes1
answer171
viewsDelete Devexpress controls
I need to remove Devexpress controls from a project due to owning these components and not having the software license. I already deleted the components and references but when trying to compile…
-
2
votes2
answers2085
viewsLINQ Group By with multiple fields
I am trying to return fields after a merge between collections, but am getting the following error: foreach statement cannot Operate on variables of type 'Anonymoustype#1' because 'Anonymoustype#1'…
-
2
votes1
answer686
viewsError: Object Reference not set to an instance of an Object
I’m having the following mistake: Object Reference not set to an instance of an Object Can anyone identify which error in my code? Follow my classes: Program: class Program { static void…
-
2
votes2
answers544
viewsReturn id or know name of the dynamic object that was clicked
Hello! I am learning now to create dynamic objects in C#, my question is how to return the Text from the button I clicked for example. Let’s say I created 10 numbered dynamic objects (in this case…
c#asked 8 years, 3 months ago Ícaro Dantas 1,088 -
2
votes1
answer164
viewsRepository Pattern - Usage Doubt
Good night, you guys. I was developing a software and started thinking about what would be the best way to implement the Repository Pattern. I have to return to the data controller of cities and…
-
2
votes1
answer837
viewsCreate temporary file using C# and ASP.NET
I am interested in generating temporary files in c#, Asp.net and I need the temporary url of this file (HTML), this file cannot have a physical path on the server due to the access of several…
-
2
votes1
answer2062
viewsList all properties of a C#object?
I need to write all the primitive properties of a C# object regardless of how many "levels" I enter these objects. I have the following object in Javascript: var objeto = { propriedade:{ valor:42 },…
-
2
votes1
answer709
viewsSet time zone for the whole project
I recently hosted an application on a North American server, so the dates are outside the Brazilian time zone. In this way, I would like to know if there is a way to define the time zone once so…
-
2
votes1
answer97
viewsComo exibr duas mensagens usando Messagedilalog do Windows phone 8.1
How do I print two messages using MessageDialog of Windows Phone 8.1? using System; using System.Collections.Generic; using System.IO; using System.Linq; using…
-
2
votes1
answer208
viewsDoubt in the operation of Automatic Migration with Migratedatabasetolatestversion
With automatic Migration the database is updated also when there is deletion of some property from my model class? That is, in addition to including a new attribute if something is added to my…
-
2
votes1
answer839
viewsASP.Net and C# - automatic e-mail sending
On the site I took over from a client, developed in ASP.Net with C#, there are registered employees with a defined admission date. The registration of these employees is in an SQL Server 2008…
-
2
votes1
answer51
viewsShow message if a particular word is typed
How do I get someone to write on cmd: > tree A message appears using the following command: Console.Write("");
-
2
votes1
answer1204
viewsQuery with parameter passing in a Url.Action
I have a controller that gets an ID and makes a listing, plus on this page I have a button to return to the previous page, so as it also gets an id, so how could I pass this id dynamically? Here I…
-
2
votes2
answers4104
viewsHow do I access and manipulate a web page in the same way that the user would access a web page?
I am planning to make a software that publishes topics in a forum. The start screen will have a menu with all categories and subcategories, when choosing one I will open in the background a link…
-
2
votes1
answer400
viewsHow to block the computer via code?
I’m trying to find a way to block the user’s computer and, only one form can be active (login form), after the user correctly type the login and password the computer would be unlocked. You can do…
-
2
votes3
answers639
viewsInstall C# application with SQL Server database
I made a simple C# application using SQL Server 2008 database. When I went to install on another computer, I came across the following error: A network-Related or instance-specific error occurred…
-
2
votes1
answer3703
viewsError: Process or Function has Too Many Arguments specified
Criei uma procedure para popular uma grid view: create procedure [dbo].[spc_listaafiliadosadmin] ( @nome varchar(100), @login varchar(100), @cpf varchar(100) ) as begin if(@nome is not null) begin…
-
2
votes1
answer139
viewsC# File encryption
I want to send files to friends but I want to make sure no one can see their content. I would like an example to perform C file encryption#.
-
2
votes1
answer159
viewsRemove white space from Chart
I’m facing a problem I can’t solve. I have a page, and it has 2 Charts, but the problem is that these Charts, are small, with lots of white space around them. I’ve tried setting up the property…
-
2
votes1
answer1627
viewsWorking with Windows Forms as designer on Linux?
On Linux (Ubuntu) it is possible to create applications with Windows Forms in the Mono or similar, using a designer such as the Visual Studio? I am facing problem because I need to develop with…
-
2
votes1
answer7457
viewsHow to make a SELECT with Entity Framework?
I’m developing a kind of a C#QUIZ, and I’ve managed to do the INSERT part of the questions and answers in the bank, but I’m having difficulty bringing the question and the answers from the bank to…
-
2
votes1
answer145
viewsCustomize Json consumption - Web API
I have the following information on Json: [ { "$id": "1", "Cditemcontacli": 1.0, "Cdcontacli": 1.0, "Descricao": "Produto 1" }, { "$id": "2", "Cditemcontacli": 2.0, "Cdcontacli": 2.0, "Descricao":…
-
2
votes1
answer85
viewsPOST coding
In web requests when posting data on a server string of the model below (using the parameters): string hello = "hello"; string token = "teste=="; It is transformed into post data equal to those…
-
2
votes1
answer530
viewsAlternative to If/Else
I have the following code: private void maskedTextBoxEAN_Leave(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(maskedTextBoxEAN.Text)) if…
-
2
votes1
answer344
viewsMVC Hidden Field Encryption - How to decrypt more than one Server-side property
Hello I’m developing a web application mvc 5 and in some cases I need to insert in the view fields @Html.Hiddenfor, only I don’t want to show the value to the user if he views the html code, So far…