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
votes1
answer1776
viewsC# - Remove QUOTES - Replace - Remove ASP Doubles
I have a variable (TEXT) that is a string, where its value is: "22/06/2018 00:00:00" How to make an Replace by removing its quotes?
-
1
votes1
answer353
viewsSave JSON file information to database
I think about the possibility of a Web system saving information from a register in a JSON file on the client’s device, which would later be sent to the BD. This will happen when the client is in an…
-
1
votes1
answer224
viewsHow to define the space a string will occupy in C# / Pdfsharp
I would like to define how far the string will take up space. the values (200,50) refer to the beginning of the text x= 200 y =50, the other 2 values I do not know for what it serves, even doing…
-
1
votes1
answer89
viewsChange Color of Datagrid
People, I need some help, I’ve done some research, but I can’t find it, I would like to know how to change the color of the selected item in Datagrid. Example: When I have a line in the datagrid and…
-
1
votes1
answer129
viewsConceptual doubt. Entity Framework, BLL and OOP
People, I request urgent help... I have a system that is running "right". Done in C# (Winform) and SQL Server (no Entityframework). However, due to studies and the need to expand the system (adding…
-
1
votes2
answers49
viewsPrevent Seed from duplicating data
I’m using this code in Seed to generate values in my table, so I don’t have to type in the database, when I change something of my code and need to give an update in the database, so it’s not…
-
1
votes1
answer882
viewsHow do I get the view id if I have Asp.net mvc?
I have the following situation, in my _Layout I am checking: @{ var controller = HttpContext.Current.Request.RequestContext.RouteData.Values["Controller"].ToString(); var view =…
-
1
votes1
answer221
viewsHow to migrate a C# system using ASP.NET?
Good morning! I’m new to the programming environment and I’m developing a C# system using Windows Forms. In the future I intend to make this same system in ASP.NET. I wonder if there is any way to…
-
1
votes1
answer168
viewsHow to get the object references in Vb.net or c#?
I have the code to follow: Dim objeto1 as new ClasseTal Dim objeto2 as new SubClasse Dim objeto3 as new SubClasse objeto2.Prop1 = objeto1 objeto3.Prop1 = objeto1 that is, I want to count the…
-
1
votes1
answer496
viewsSending form to Pagseguro
I have this form @using (Html.BeginForm("PacoteAdd", "Pacote")) { <input type="hidden" name="email_cobranca" value="*****@hotmail.com" /> <input type="hidden" name="tipo" value="CBR" />…
-
1
votes1
answer40
viewsHow to remove /home/ from a View URL specifies ASP.NET MVC5
I need to create a View called BancoDeImagens but I need her URL instead of being: www.site.com/home/Bancodeimages I would like to remove the /home/ and separate the names by - to keep it that way:…
-
1
votes1
answer52
viewsWeb Extension in Visual Studio 2012
I installed Visual Studio 2012 Express on my machine and did not add the extensions needed to work on the Web. In Visual Studio there is the option to add extensions and updates. There I located…
-
1
votes1
answer640
viewsMy access is being denied by executing the following code
private void GerarPDF(string pCaminhoArquivoPDF) { Document doc = new Document(); // Aqui acontece o erro PdfWriter.GetInstance(doc, new…
-
1
votes1
answer710
viewsHow to generate a report in excel with tables from a database using C#?
How to pass the data of a query to the columns and rows of a sheet in excel? Example: OleDbDataAdapter oda = new OleDbDataAdapter("select * from usuario", conexao.cn); DataTable dt = new…
-
1
votes0
answers27
viewsNhibernate keep two Mapping for a single object
i would like to keep two different mappings for a single object is possible to do this with Nhibernate?
-
1
votes0
answers60
viewsUpdate Page( windows) during Button Click, Spinner stops working on WPF C#
I’m making a WPF application in c#, that when I click the query button on the bank. It starts spinning a "Spinner" that is inside the Usercontrol; private void BtnBusca_Click(object sender,…
-
1
votes2
answers21
views -
1
votes1
answer685
viewsDisplay balloon popup on a label
I would display a small message to the user, style those when passing the mouse, if I am not mistaken would be the attribute alt="my message" however I am using Asp.net-mvc-5 and I am finding it…
-
1
votes1
answer233
viewsAsp.net HTTP Client get with query string
Developed on an Asp.net mvc I intend to implement an HTTP request that with this part of code the meteorologies present me a "list" with the parameters of the query…
-
1
votes2
answers88
viewsRename error message
Follows model: [DisplayName("Data:")] [ValueParser("ptdateparser")] [AssertThat("DeadLine > Today()", ErrorMessage = "* Data deverá ser superior a data de hoje")]…
-
1
votes1
answer82
viewsNullreferenceexception Unity 3D
I started a course where they teach to create a 2D game using Unity3d, I tried to add things to the game but I am failing miserably and so I decided to try a little help. In this case, I tried to…
-
1
votes1
answer65
viewsChanging customer information via ID
I cannot change customer information through ID Code that makes the changes in the Database public void Atualizar(Contato contato)//metodo para atualizar dados: update { OleDbParameter[] parametros…
-
1
votes1
answer82
views -
1
votes1
answer294
viewsRising Counter in a Texbox
I am developing a software that every time the user clicks on the button salvage, it needs to add the +1 value in a TextBox. Ex: Box = 1 -> Save -> Box = 2. Every time the user clicks salvage,…
-
1
votes1
answer66
viewsHow to set acceptable single values for an Enum property in a Serializable class?
Given a enum as an example: public enum IcmsCst { [XmlEnum("00")] Cst00, [XmlEnum("10")] Cst10, [XmlEnum("20")] Cst20, ... } There is a form of annotation so that I could specify that a certain type…
-
1
votes2
answers417
viewsPick image coordinate by clicking on it
I’m in a Xamarin/Android project. I need that when the user touches on a ImageView I can get the coordinates (from the image) from that touch. How to do this?
-
1
votes1
answer324
viewsHow to change the color of the Repeater line at runtime
How do I change the line color Repeater running ? Repeater lines are loaded through what comes from the database. Example: If there are 3 lines, when displaying in Peater, the first line is of one…
-
1
votes1
answer150
viewsAjaxpro not accessible on IIS
I have a simple application with Webforms, I created some methods that I will access via Ajax via Ajaxpro DLL. I used the attribute [AjaxPro.AjaxNamespace("Teste")] in class and the…
-
1
votes1
answer156
viewsError while using Parallel.Foreach
I am making some improvements in a method, which today takes on average 19 to 22s to bring the information to VIEW and saw the possibility of replacing the foreach for Parallel.Foreach. I changed…
-
1
votes1
answer186
viewsHow to Debug a Windows Service?
I did a Windows Mail Sending Service every 5 minutes and would like to know how to debug it. I saw several tutorials on the internet, but could not perform debugging. Would anyone know how I would…
-
1
votes1
answer85
viewsAt runtime, does the Form ID Asp.net webforms change?
At runtime, the Form ID Asp.net webforms changes, see that I have on my machine the component ID. Local example: <asp:HiddenField runat="server" ID="MenuSelecionado" value="processo"/> After…
-
1
votes3
answers878
viewsHow to hide URL ID?
17/11/2016 I have an application that is mounting the following URL www.meusite.com.br/controller/action/id However, I need the ID not displayed in the URL, but let it live on back-end, because it’s…
-
1
votes2
answers996
viewsMetodo Json - Return
I am developing a return of Zip Code through the post office API, the part that is in the controller is working, but I do not know if the return is correct, nor how to use in the view. If anyone can…
-
1
votes1
answer1179
viewsSet Value in a @html.Dropdownlist
In an address registration form, I’d like to do the following. the guy types the zip code, then searches the zip code, and returns the data to fill in the Editorfor. So far so good, it’s working.…
-
1
votes1
answer328
viewsGenerating a New File with an Excel template when Saving
Good morning, My software works with barcode reading for generation of printed labels. It has several Texbox , each receiving a different code from the reader. By clicking on Save it sends these…
-
1
votes1
answer59
viewsSearch information in the database in one SQL code line per logged in user
I have already been able to search all the dates of the database. However, I would like to search through a specific ID that is logged in to the system. Per session, in case. But this code is giving…
-
1
votes2
answers582
viewsPass information between C#RMS
Hello, I have a problem to pass information between windows forms Forms with C#, the problem is as follows. I have a MAIN FORM, from this I call the a SUB FORM, which happens to be the son of the…
-
1
votes1
answer776
viewsHow to simulate SSL on ASP.NET localhost?
How to simulate an SSL certificate on localhost, use Visual Studio 2017, running ASP.NET MVC5. I need this because I am running the API da Cielo which only accepts requests via SSL. Edit: If I…
c#asked 6 years, 4 months ago Leonardo Bonetti 5,313 -
1
votes1
answer4261
viewsCurrent time of the states of Brazil C#
I’m trying to get the current time of the states/DF Brazil with different time. I found the code below but it didn’t help much. Does anyone know any way to do it without webservice? public static…
-
1
votes1
answer2059
viewsDisplay alert when loading page
I’m using Asp.net-mvc and as far as I know the Onload event would work if I put in body, which is in ~Layout, but I need this alert to be displayed in a single page, because if I put in body will…
-
1
votes2
answers672
viewsHow to open the notepad with contents inside without saving?
I would like to know how to open the notepad using C#, with content generated through a string, but I don’t want you to be safe anywhere.
-
1
votes1
answer3574
viewsCalculate percentage
Largura * Complemento = Subtotal + Porcentagem = Total subtotal.Text = (Convert.ToDouble(largura.Text) * Convert.ToDouble(complemento.Text)).ToString(); total.Text = (Convert.ToDouble(subtotal.Text)…
-
1
votes1
answer242
viewsHow to return to the beginning of a C#Array
I have to develop a code where he does the Cesar Cipher encryption, the characters I should use should be in this sequence; A~Z,(blank space),0~9. I’ve developed most of the code, only I ran into a…
-
1
votes3
answers77
viewsFind an index of a value in a matrix
I’m looking for a matrix index for a value: List<string> list = new List<string>() { "Leão", "Guepardo", "Elefante" }; String[] array = new String[3] { "Leão", "Guepardo", "Elefante" };…
-
1
votes2
answers219
viewsC# - Initialization of an array/list
I wonder if you can instantiate a vector of size n and initialize it with a specific value. (Without using one for this) For example, I would like to instantiate a vector, which will have size 100…
-
1
votes3
answers179
viewsSelect the Controller name via Javascript
I have the code below and would like to add to class="current" to <li></li> according to the controller I am accessing. I want to do this to make the item stand out. <ul…
-
1
votes0
answers12
viewsHow to move a Uitextfield in Xamarin.Ios?
I wanted to move one UITextField up or down in order to solve the problem of 'Keyboard' tried this way TextChaveAcesso.Frame.Location = new CoreGraphics.CGPoint(TextChaveAcesso.Frame.Y,…
-
1
votes2
answers91
viewsTesting Plans in VSTS
I’m trying to create Tests Plans on VSTS (Free version), but I am not finding the location indicated in the documentation: Instead, I get this interface: By chance the Free version of VSTS does not…
-
1
votes1
answer178
viewsException when adding usercontrol more than once
Hello. I have a user control newsletter and it is added in various places within the project, for each page on which it is called, a property is set to insert the email into a particular group of…
-
1
votes1
answer688
viewsHow to set a string-like field to nullable in Code First?
I got the field descrPapel of the kind string and would like that field to be created as nullable, that is, to accept null when I was gonna do some Insert/update in records of this type of entity.…