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
-
1
votes0
answers203
viewsSelected Checkbox list only contains those on the screen
I have a GridView containing a list of items with a checkbox and make use of the code below to "paginate" the table: $(".gvdatatable").dataTable(); The problem occurs when I check which ones…
-
1
votes1
answer118
viewsProblems with creating not null fields with Fluentnhibernate
I have a problem creating the fields using Fluentnhibernate and Postgres. User class: public class Usuario { public virtual int idUsuario { get; set; } public virtual string nome { get; set; }…
-
1
votes2
answers173
viewsHow to read only one line from a file in c#
I know how to read the whole file but how can I read only one line EX: read line 3 only
-
1
votes2
answers952
viewsHow to center text in a Messagebox?
Right now I have this code: MessageBox.Show("Verificação da password incorreta \n Insira novamente"); And the output gets like this: Verificação da password incorreta Insira novamente How do I make…
-
1
votes2
answers144
viewsRedudancia interface with Disposable
I saw an example of implementing a interface with Disposable which I think is redundant and I would like to know whether I am right. Following example to illustrate: public interface…
-
1
votes0
answers136
viewsSave multiple photos in SQL Database in same ID
I’m having trouble saving multiple photos in a single id this is the Cs of the page that makes the register protected void btnSalvarImovel_Click(object sender, EventArgs e) { try { var cmd = new…
-
1
votes1
answer145
viewsRunning Query with SUM in HQL?
I’m trying to use the SUM to sum an attribute of an entity using HQL of NHibernate, but whenever I execute the query returns empty. I am following the example here but I still can’t do it. How to do…
-
1
votes1
answer26
viewsHow to perform event with instantiated class in another method
I have a method that triggers a "Bandedgridview" : private void popula_retContrato(string contrato) { Classes.Datatable.Datatable_cliContrato dat_contrato = new…
-
1
votes1
answer505
viewsRegular Expression Regex
I want to make patterns that way: [a-z]+[acentos] || [a-z]+[acentos]+[espaço]+[a-z]+[acentos] || [a-z]+[acentos]+[-]+[a-z]+[acentos] In order to be able to register a word, it is necessary to be…
-
1
votes2
answers1432
viewsGet the value by a comparison between C#Arrays
Well, I got two arrays: first string[] pastasSistema = new string[] { "Content", "DataRv", "My Skype Received Files", "RootTools", "shared_dynco", "shared_httpfe" }; 2nd string[] diretorios= new…
c#asked 8 years, 1 month ago user37440 -
1
votes2
answers113
viewsDenied file deletion on C#
I am using the following line to create and record: File.WriteAllText(caminho + cliente, xml); In it I write an XML and then I deal with it as follows: if (File.Exists(caminho + cliente)) {…
-
1
votes2
answers472
viewsHow to make a Textbox accept only the letters S and N?
I’m studying about TextBox in C# and I have no idea how to do this function.
-
1
votes2
answers1873
viewsHow to check if the query did not return data?
I have a query and would like to know if the same returned data. //classe aplicação- private List<tb_cabecalho> TransformaReaderEmListaObjetos(SqlDataReader reader) { var retornando = new…
-
1
votes1
answer1137
viewsRegex for addresses (Streets, Avenues and Etc)
I need a regex that takes cases that have number in the address name and also normal address. The Number always ends after the address. Example: R 25 March 200. I need the address that would be: R…
-
1
votes2
answers192
viewsCompile a. NET application into a self-contained executable
I wondered if it is possible to compile an application . NET Framework in just one executable file. No files .dll outsiders. I did some research but was unsuccessful.
-
1
votes2
answers112
viewsHow to run a subconsultation on LINQ C#?
How to run a subconsultation on LINQ C#? SELECT ap.ID FROM Aplicativo AP WHERE AP.Tipo IN (2,6) AND AP.ID NOT IN (SELECT filhoID FROM relacoesobjeto WHERE filhoclasse = 555)…
-
1
votes1
answer65
viewsHow do I treat message with special characters
I am consuming a REST service that is returning the following message with special characters: "Espã Título Inválida" It is possible to treat this message?…
-
1
votes1
answer758
viewsError consuming Nfse webservice with mutual authentication - handshaking
I have a problem to consume the webservice of Electronic Invoice of the city of Sertãozinho. This Nfse server uses Tomcat with mutual authentication (handshaking). The production server address is:…
-
1
votes2
answers1205
viewsHow to envelop the Nfe shipment batch in the header using C#?
Hello, I have no experience with WebServices, but I’m trying to develop a NFCe and I’ve already been able to authorize some notes in type approval environment. Gero XML using C#, then I validate,…
-
1
votes1
answer82
viewsTask em await Task.Whenall New transaction is not allowed because there are other threads running in the Session
I’m doing a show Console, where he basically performs these 4 procedures Recovers a IEnumerable<_Url> Make a stop on those urls Inserts to the Database Mark this _Url as read (processed) so it…
-
1
votes1
answer29
viewsGetting value inserted in Asp text field. Net
I have a GridView and in one of the columns I have a field textbox where I insert values into them. I would like to know how to get the typed values of the fields, I have already done the following:…
-
1
votes1
answer59
viewsHow to detect when the mouse is pointing to a button
I have a form where certain actions will be executed only when a button btn have the mouse cursor on it, which button event I use ?
-
1
votes1
answer830
viewsPOST is not receiving JSON
I need some help with running a POST. 'Cause when I try to call my API (http://www.afectus.com.br/api/teste) for the execution of a Post, I am unable to pass the JSON to her. Follows the API used:…
-
1
votes1
answer135
viewsChange print quality in C#
I am creating a program in which at a certain point it needs to print a budget... using(PrintDocument print = new PrintDocument()) using(PrintPreviewDialog dialog = new PrintPreviewDialog()) {…
-
1
votes1
answer29
viewsSet array type property size
I have a property that is of type array. This array should have two dimensions being 7 rows and 4 columns, ie, Anytype[7.4], code: public class WorkingDays { public TimeSpan[,] Times { get; set; } }…
c#asked 6 years, 7 months ago Matheus Saraiva 2,157 -
1
votes0
answers162
viewsWeb.config encryption and RSA key container
It’s been discussed how encrypt Web.config, has also been discussed as use encrypted Web.config, but my doubt is as follows: If you are using the default provider Rsa Protected Provider to perform…
-
1
votes2
answers530
viewsWinforms C# - Display loading form
I own a main Winforms and would like while the asynchronous task is processing a new form (with GIF) is displayed, this would only close upon completion of processing. frmProcessor _frmProcessor =…
-
1
votes0
answers208
viewsAutomapper error in relationship
I have the following classes: public class ListaGrupo : EntidadeBase { public ListaGrupo() { Items = new List<ListaGrupoItem>(); } public int Id { get; set; } public string Nome { get; set; }…
-
1
votes2
answers2096
viewsFind a string anywhere in the List c#
Good Afternoon. I would like to know how to find a string anywhere in the list. Ex.: string "123". It can be in Pessoa.id, Pessoa.Nome, Endereco.id, Endereco.Rua or Endereco.CEP; People’s List…
-
1
votes1
answer268
viewsChange the dynamic menu item in Asp.net, from "mouse Hover" to click
I have a dynamic menu in Asp.net and one of these menu items contains a submenu, but to access this submenu happens a "mouse Hover" event that does not appear in my code. I need to change this event…
-
1
votes0
answers51
viewsMy function is not checking the IF condition is already going straight into the ELSE
private int dia; private int mes; private int ano; public bool GravaData(int d, int m, int a) { if ((d > 0 && d <= 31) && (m > 0 && m <= 12) && (ano >…
-
1
votes1
answer1013
viewsGenerate ASPNET CORE MVC reports
Is there a solution to generate reports in ASPNET CORE 2.0 MVC applications without needing a reporting server? I did some searching and did not find much on the subject.
-
1
votes1
answer43
viewsDoubt about Xamarin-Forms
Good night, I am starting a TCC project with development for mobile platform and my group we are developing using the platform Xamarin Forms, my doubt is about the creation of the project, because…
c# xamarin xamarin-forms xamarin.android xamarin.iosasked 6 years, 7 months ago Giovanni B. Preivatti 55 -
1
votes1
answer44
viewsDownload Async + Copy = Copying image 0 bytes
I am simultaneously downloading several photos, and also need to make the copy to a certain folder. What happens is that it makes the copy before finishing the download. public static async Task…
-
1
votes1
answer292
viewsError Reportviewer 14.0.0.0 Window.$Rsjquery
When you click the button to expand groups in reportview, it keeps clicking forever and gives error in the line below: // error Uncaught TypeError: window.$RSjQuery is not a function if ($) {…
-
1
votes2
answers739
viewsC# EFD-REINF 1.03.02 - Invalid event signature. Invalid XML document Digital signature
all good? I’m trying to make the reference to the digital signature of EFD-REINF (The latest version 1.03.02) event XML (in this case I am testing with R1000) with .Net C#, but framework 4.0. I…
-
1
votes1
answer51
viewsHow to make database transaction in Webforms?
I got a stock in a file .aspx that runs multiple Inserts in the bank. I need that if something fails, the operation is canceled, since one record will depend on the other. I usually use a…
-
1
votes1
answer203
viewsObject as parameters for C#API
I have a request made in Angular for C#. However I don’t know how to receive the data in My API In C#. getWithFilters(filter: any) { let parametros: any = { razaoSocial: filter.razaoSocial, cnpj:…
-
1
votes1
answer953
viewsList existing folders/subfolders and files in a specific root folder
It is possible via code to list existing folders/files in a specific folder ? Example And play this list on a grid/table on the WEB for the user to know if the folder he wants to create already…
-
1
votes1
answer212
viewsUse of bindingNavigator
I fill a dataGridView via SQL and filling a dataTable. I’d like to associate a bindingNavigator eastward dataGridView. I’m not getting it. Follow the code. string arquivo =…
c#asked 8 years, 1 month ago Jose Carlos Taveira 70 -
1
votes1
answer244
viewsForeach without repeating the name
I have a Foreach in View, and it contains Description, Qtd and dta,how do I make a foreach without repeating the description? Ex: I have a product X whose were removed 10 units day 01/10/2016, 3…
-
1
votes1
answer299
viewsWhat is the default value of a primitive type variable in C#?
When a primitive type variable is created but not initialized its value is null? Example: public int x; If I don’t do anything with x, which means I don’t assign a value to it, it will be null?…
-
1
votes0
answers61
viewsVB.NET - How to make a Loopback Serial Test program in Universal Windows Platform?
I have a problem translating the code C# to VB.NET on the UWP platform making a Serial UART Test Example made available by the Microsoft website. The program in C# is working perfectly, but when I…
-
1
votes0
answers25
viewsPartial with Javascript
If I create a Partial this way below "given as example": <script> //Codigos C# Meus documentos.. //Codigos Javascript... </script> ... and within this partial contain code c#, this…
-
1
votes1
answer528
viewsHow to remove the title bar from the Visualstudio C# Xamarin android app
I’m having difficulty removing the title bar of the app I’m developing, I tried for android studio and failed miserably as well as in visual studio, as I’m not good in java opted for the look I have…
-
1
votes1
answer59
viewsNavigation between pages (Android)
using Android.App; using Android.Widget; using Android.OS; using System; namespace ValModas { [Activity(Label = "ValModas", MainLauncher = true)] public class MainActivity : Activity { protected…
-
1
votes1
answer44
viewsEncountering Problem Bank Connection with Visual Studio
Hello, does anyone know if you have any way to find problematic c c# code related to opening and closing database connections? I have an application that after a few hours processing a load when…
-
1
votes1
answer492
viewsC# BD . mdf connection string
Good evening, you guys, I have a database . mdf in a Windows Forms and want to make the connection string of it, can anyone help me? My version of Visual Studio is 2015 and the file is: C:Documents…
-
1
votes3
answers184
viewsReturn BD values via ajax
I have a screen where I must popular with database values using ajax. When I click on the button to fill the fields the following error appears: Failed to load Resource: the server responded with a…
-
1
votes0
answers72
viewsDuplicate image error on save!
My function that saves the images in the folder works properly, but when I open the photos folder the images appear duplicated however with different names Follow the save function: protected void…