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
votes2
answers210
viewsEntity Framework 6: Provider Error
I am using EF6 Code First. While performing "Update-Database" the database is normally created. But when entering the data the following error is launched: No Entity Framework Provider found for the…
-
2
votes1
answer3378
viewsMask for phone and mobile phone (8 or 9 digits) in the same textbox winforms
Good evening, I’m having trouble creating a mask that accepts both cell phone number and phone number in the same textbox, I tried to use the maskedinput no more rolled.. Any idea how you could do…
c#asked 6 years, 1 month ago Joao Pedro 143 -
2
votes1
answer45
viewsI would like to assign yesterday as an initial date every time my program is started on a dateTimePicker
I can assign value to it just don’t know how to assign a Yesterday private void Form1_Load(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Today; }…
-
2
votes1
answer409
viewsSearch in a string with wildcards
I wonder if there is a function q search in a string, using wildcards. For example linha.contains("*//*#include");
c#asked 6 years ago Fabio Zanardo 45 -
2
votes4
answers479
viewsRemove object from an Arraylist
I have an arraylist of objects, and I need to remove an object from it as follows. I need this object to be removed if its box attribute stores the same value that was typed in mine TextBox. Why am…
-
2
votes1
answer102
views -
2
votes1
answer404
viewsFill a select with callback $getJson Asp.Net / Jquery
What I need to do is this, I have a select with the states, when the person changes that state I need to fill another select with the cities. This is the state select : <div…
-
2
votes2
answers1783
viewsX.PagedList.Mvc with Core and Bootstrap 4.0
How to use the X.PagedList.Mvc with Core and Bootstrap 4.0, and thus create a full automatic pagination.
-
2
votes1
answer4068
viewsHow to show error message?
I am developing a C# register in Visual Studio and created a method to include a new record in the database. The method is as follows:: public static bool Inserir(Usuario pUsuario) { try {…
-
2
votes2
answers244
viewsRemove Arrows from Editorfor
I created my class with the guy int [Required(ErrorMessage = "Preencha o Numero")] [DisplayName("Numero")] public int Number { get; set; } and so on Layout generated these little arrows, how do I…
-
2
votes1
answer575
viewsProblem when doing Table Insert in Postgresql
When I’m gonna make a INSERT: INSERT INTO categoria (cat_descricao,cat_status) VALUES ('não' ,'1' ) passing some element with accentuation parameter the following error occurs ERROR: 22021: invalid…
-
2
votes1
answer135
viewsError while logging in applications
Well, here’s the scenario: Have 2 applications ASP.NET MVC on the same project, which are using a Dominio in common. I’ll call it MVC1 and MVC2 to get better at exemplification. I installed the…
-
2
votes1
answer198
viewsN for N Entity Framework
Dear, I am trying to carry out a relationship N to N in the Entity Framework for the tables described below. At the moment what is happening is a cyclical redundancy, where every time I open a…
-
2
votes4
answers567
viewsHow to know if the first character of a string is capitalized?
I need to know if the first character of a string is capitalized and does not let the program follow. How to do? Console.Write("Digite o nome do " + i + "º rei: " ); kings[i] = Console.ReadLine();…
-
2
votes1
answer145
viewsError opening Package Manage Console
When I open the Package Manage Console give me the following message: Join-Path : Cannot Convert 'System.Object[]' to the type 'System.String' required by Parameter 'Childpath'. Specified method is…
-
2
votes2
answers359
viewsKeyword "new" in C#
I went to see about the keyword new in C#, but I could not find someone who explains well what I want to know. They say that the new creates a new instance, but I don’t understand exactly what they…
-
2
votes2
answers219
viewsRelative path to txt in ASP
Good afternoon, I am generating a file with Asp net the function saved in the hard drive if I put the path, however this file will be saved in a server and I’m having difficulty to put the relative…
-
2
votes2
answers1251
viewsWPF C# String Format
I have a usercontrol with the following configuration: <UserControl x:Class="PainelPendencias.View.PendenciaConsulta" x:Name="uCPendenciaConsulta"…
-
2
votes1
answer52
viewsWpf C# Oledbparameters Update Where select
I’m trying to change a query to use Parameters but when running using Parameter I get the "Data type Mismatch in criteria Expression" error. Without Parameters works normally. Follow the two…
-
2
votes3
answers159
viewsDoubt how to capture the character’s animation in Unity
I’m trying to make a command that activates an animation when I press 2 keys of Keyboard and when I stop pressing one of them, this animation stops. For example I chose the "w" + "leftShift" key,…
-
2
votes1
answer2305
viewsPass and grab the Commandparameter from a Xamarin Forms button
How to pass a value that is in one Binding for CommandParameter of a button that is inside a ListView to the ViewModel ? The button is accessing the Command but I don’t know if this is how the…
-
2
votes1
answer415
viewsDelete Regedit Key Windows
I’m making a program in C# to automate a situation here in the company, only that I am facing problems with it I am wanting to delete a windows registry key gets located on HKEY_LOCAL_MACHINE…
c#asked 5 years, 11 months ago Alisson Dias 56 -
2
votes1
answer255
viewsOperator overload in C#
I have some questions about overloading operators in C#. What good is? His concept is the same as Overload in Java methods? Is there any practical example of doing such a procedure on a day-to-day…
-
2
votes2
answers169
viewsWrite program in another’s textbox
Hello! I used the program "Exe Lock" to block some files of mine, everything works perfectly, the problem is that I was trying to open the locked file with a program in C# and the program itself…
c#asked 7 years, 9 months ago Ícaro Dantas 1,088 -
2
votes1
answer466
viewsRemove Report Viewer Edge
I have tried several ways to remove this border that appears in the Viewer report, and I could not at all. Below is part of my code with the properties I added to remove the border:…
-
2
votes2
answers311
viewsChange tab of Tabcontrol
I am creating a Windowsform template and I am using a Tabcontrol and would like to create an event that changes the tab that is being displayed. I was able to change the content displayed with…
-
2
votes1
answer757
viewsHow to resize image independent of size?
Follow the code below: public FileContentResult Foto_Pequeno() { byte[] byte_image = null; string query = "SELECT * FROM Imagem WHERE Id = '1'"; using (var connection = new…
-
2
votes1
answer301
viewsRegular expression to validate text
I am making a method that will import some data, and before the import I need to check if some fields are correctly filled, the fields should come this way: Example: Jan/Seg Fev/Ter Mar/Qui The data…
-
2
votes1
answer45
viewsI can’t perform a Repository search with Nhibernate C#
I’m new as a programmer, sorry if I can’t explain clearly, but please tell me what I did wrong and if possible how to do better, I want to improve as a programmer and user here at Stackoverflow I am…
-
2
votes1
answer204
viewsHow to create a compound index in Sqlite via Microsoft.EntityFrameworkCore.Sqlite?
I’m trying to create a unique composite index, but I don’t know how to do it on Microsoft.EntityFrameworkCore.SQLite, I’m used to working only with the Doctrine and Hibernate and I’m totally lost.…
-
2
votes1
answer406
views.NET Core + Visual Studio Code - Structure organization
I have here with me some questions about developing applications in . NET Core using Visual Studio Code: How a base project is created, such as a "Blank Solution", as in Visual Studio? How is the…
-
2
votes1
answer312
viewsError while trying to read excel file C#
public partial class FrmEditar : Form { private OleDbConnection _olecon; private OleDbCommand _oleCmd; private static string _arquivo = string.Empty; private string _stringConexao = string.Empty;…
-
2
votes3
answers551
viewsConvert string to integer positions
Console.Write("Digite um numero de 4 digitos: "); string numero = Convert.ToString(Console.ReadLine()); int soma = 0; for(int i = 0; i < numero.Length; i++) { soma += Convert.ToInt32(numero[i]);…
-
2
votes2
answers85
viewsError while deleting second List item
I am using the following code to delete items: if (e.KeyCode == Keys.Delete) { var remover = listaPedido.SingleOrDefault(r => r.ItemOffline ==…
c#asked 7 years, 9 months ago Italo Rodrigo 4,344 -
2
votes0
answers47
viewsUse the first part of the split
I wonder if you have how to use the split to make only one division, for example, I have the following text:: dia_24_06_18. I wanted you to separate by _ in the matrix like this: [0] - dia [1] -…
-
2
votes1
answer90
viewsSQL command in C#
Well I’m doing a crud using mvc and Entity framework, only I don’t know how to pass parameters... here’s my code public void Cadastrar(TimeModel timeObj) { strQuery = "INSERT INTO TimeFut (nome,…
-
2
votes4
answers1341
viewsUpdate Listview after return with Popasync in Xamarin Forms
How to update the ListView after returning to the View using the PopAsync ? I need the ListView load items from it after the Address Insertion View saves a new address. OBS: The PushAsync or…
-
2
votes0
answers492
viewsUnable to start program 'C: Program Files (x86) IIS Express iisexpress.exe'
My visual studio from night to day started to give an error when starting the application, this error only happens the first time I start the application (Asp.net mvc 4), in other times iis starts…
c# asp.net-mvc visual-studio visual-studio-2015 asp.net-mvc-4asked 7 years, 9 months ago Daniel Aragão 36 -
2
votes1
answer86
viewsDoes not accept Enum parameter with non-zero integer
Follows code: class Program { public enum Enum { Casa = 0, Apartamento = 5 } public static string MinhaFuncao(Enum @enum) => "MinhaFuncao"; static void Main(string[] args) { var r =…
-
2
votes1
answer63
viewsstate' cannot be Assigned to -- it is read only - Entity Framework
Follows the code: var resultado = db.Tabela .Where(l => l.Nome == "João") .Select(l => new { l.numero, l.cidade, l.estado, l.pais }); I know that in the database has "SP" value of the state…
-
2
votes1
answer105
viewsMonitor opening of Forms C#
I need to monitor the opening of Forms within a C#application. For example, every time you open a Form within the application, the application must execute a method or trigger an event with…
-
2
votes2
answers74
viewsTyping
I am creating a database and in it has a field that receives a date, I would like it to appear only the date. If I use the type datetime comes with the time too. And in SQL Server you have the type…
-
2
votes2
answers293
viewsUsing Linq to sql, how do I get the generated sql query?
Hello. If I have an example: var agendamento = _repository.First(a => a.iid == id && a.locIid == _usuario.LocalidadeContextoId && a.activeVersion == 0, "", true); I can see the…
-
2
votes1
answer456
viewsHow to Input Data in Debugging with VS Code
I started using VS Code to program, I like it a lot. But in a simple console application, when I am in debugging and arrives in a line with Console.ReadLine() you can’t input data, I write on the…
-
2
votes3
answers196
viewsGrowth ranges of an array’s values
I’d like to know a way to determine growth intervals and decreasing of a vector in C#. Example: Array[0]=0; Array[1]=1; Array[2]=2; Array[3]=3; Array[4]=4; Array[5]=3; Array[6]=2; Array[7]=1;…
-
2
votes2
answers224
viewsDelete string until it reaches the character and ":"
How to delete a part of the string until it reaches the ":" character. I was able to delete ":" using the code below: Example String: uma_phrase_random: Ronison string url = empresaweb2; string…
-
2
votes0
answers49
viewsIs it normal to pass null variables from the client side to the service side?
My goal is to create three applications: in WCF, in ASP.NEW Web API and another in WPF. My question is this:: It is normal, the data that we initialize on the client side namely (WPF) and that we…
-
2
votes2
answers266
viewsAssociation 1 to 1 Entity
I have a relationship between Address and Academy where 1 address has 1 gym, and 1 gym has 1 address. Academia class: public class Academia { [Key] public int AcademiaID { get; set; } ...…
-
2
votes1
answer256
viewsApplication does not open in windows XP because it does not have administrator permission
I am having a problem, the executable of my program does not run on windows XP because of user permission issues. On other systems, you put it to run as administrator and it works normally.…
-
2
votes2
answers2474
viewsHow to use Chart.Js with ASP.NET MVC
Well, I’m returning a list of and sending to View. And I need to implement this through a chart with Chart.js. I have the class Parents: [Table("Pais")] public class Pais { [Key] public Guid PaisId…