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
answer84
viewsAlphabetical ordering in Listview equal to the People App
I’ve been searching how to make a list like the App People (People) contact list of Windows 10 and found a good one example. But the example does not implement the alphabetical ordering that exists…
-
2
votes1
answer154
viewsDatetimepicker with custom dates
I am developing a consultation marking system in Windows Forms and had the idea to include a DateTimePicker where only dates with available vacancies must be "clickable" by the user. There’s a way…
-
2
votes1
answer1176
viewsHow to print file without opening?
My system generates a PDF created in iTextSharp and I use the following code to open it: System.Diagnostics.Process.Start(nomeArquivo); nomeArquivo is the address of the PDF file. How do I send the…
-
2
votes2
answers477
viewsValidation of Textbox
I have the following piece of code that limits a TextBox receivable only numbers and comma: private void txtTempoAcel1_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsDigit(e.KeyChar)…
-
2
votes1
answer47
viewsEvery time I upload files I get a large amount of errors
I need help. Every time I upload any file in Visual Studio 2015 I get a huge amount of general errors. I’m starting to develop for windows phone and soon when importing the first sample, downloaded…
-
2
votes3
answers386
viewsCall a single time method within an Event Handler that is called several times?
I would like to know how I do to ensure that a method be called once within a Event Handler C#, whereas this Event is called several times. Example: //meuEventHandler é chamado várias vezes.…
-
2
votes1
answer73
viewsVisual Studio 2013: How to reference project folders in Using
I have a problem,I have in the same project the stock and the box,I am making a screen that allows you to choose between them and depending on the button you press it opens one of the two. However…
-
2
votes1
answer620
viewsC# MVC Routebase routing Too Many Redirects
I have an all dynamic system where I get all my paths, controllers, views and areas from the BD. My problem now is when I try to access a page it returns to me too many redirects response. What…
-
2
votes1
answer88
viewsHow to handle multiple parameters not required on a route
I have the following wheel on an Asp.net mvc control: [Route("video/categoria/{categoria}/{page?}/{sort?}")] The three parameters are: categoria, filters the video category, page? is the pagination…
-
2
votes2
answers1984
viewsC# - How to close the login form(initial program form) after calling another form?
I was able to do the entire database part of the login form, so that if the user enters login/password with data that are in the database, he can access. Only when I open the other form, the login…
-
2
votes2
answers104
viewsError saving a Many-To-Many relation
Following the models that of that question, I am having problems trying to save the data (keys of each of the records) in the table created to make the data relationship. Follows the post method I…
-
2
votes2
answers80
viewsProblem with Jquery dialog
I have a ListView which creates some buttons dynamically according to Idpassoworkflow, and as the step I need presents a message to the user confirms whether or not to execute the action, only that…
-
2
votes1
answer421
viewsCurrency Value to Double Conversion
I have the following value in Double: 1000.0 Using the command: string.Format(CultureInfo.GetCultureInfo("pt-BR"), "{0:C}", 1000.0); I have the exit: R$ 1,000,00 My question is, how to convert R $…
c#asked 7 years, 8 months ago Lucas Duzo 37 -
2
votes0
answers39
viewsHow to change the DOM and click using ABOT
How can I capture the return of a button request submit using Abot? With the code below I can search through the árvore DOM, modify the values of my inputs and capture the element that performs the…
-
2
votes1
answer138
viewsFind a uppercase letter in the text
I’m doing some text checks for password. I’ve already located for special character but I couldn’t find for high letter. I used Regex. For example if the text contains "test" returns false and if it…
-
2
votes0
answers959
viewsWhat to do when the generated token expires?
I’m developing an API rest with the Framework Asp.Net Web Api 2, using Owin. I have an app android as the client. In this case, my system has users and passwords and authenticates normally. I want…
-
2
votes1
answer1098
viewsHow to configure Web Api route to accept named parameter(query string)?
I have a web api with the following method: [HttpGet] [Route("api/documento/doc/list?{cpf}")] public string Listar(string cpf) { return "value"; } I need the above method to be called through the…
-
2
votes2
answers399
viewsUse Viewbag as counter
Is there any way I can use the ViewBag as an accountant? WHAT I NEED? I’m making phone registrations. When I add a new phone, I send my View for my Controller and he returns me to PartialView of my…
-
2
votes1
answer87
viewsConvert SQL script to Linq
I need to convert the SQL script below to Linq. SELECT [ID_Pessoa], [ID_ArquivoPagamento], SUM([Peculio_Valor]) AS 'Peculio_Valor' FROM [VW_PESSOA] WHERE [ID_Pessoa] = @ID_Pessoa AND…
-
2
votes2
answers11603
viewsHow to break lines (console mode)?
How I break lines in C#, as if I put two commands Write the console will print them side by side, as I do to print on the bottom line. Ps: Code below var A1 = Console.ReadLine(); var A2 =…
-
2
votes0
answers100
viewsENTITY truncating decimal value when doing SELECT
I have the following situation, When executing a query using LINQ, I get the following return 5178560,00 but if I run the same query, directly in SQL SERVER, it returns me 5179975,00. It’s not a…
-
2
votes1
answer192
viewsHow to add properties to WPF components?
I can use as an example the System.Windows.Controls.TextBox. How do I add more behaviors and properties to it? In a real context, I would like the component TextBox had a boolean property HasErrors,…
-
2
votes1
answer425
viewsIs it possible to validate the import of an excel file with regular Expression?
I am importing an excel file using Asp.net and validate to see if it is really an excel or not. I don’t want to use if and else, so I’m trying to do this through Annotations. My main idea now is to…
-
2
votes2
answers46
viewsID is null when I enter the details by index
When I enter the registration details by the ID index it is always null. http://localhost:17542/Availability/Details/0 Controller Details: public ActionResult Detalhes(int? id) { var disponibilidade…
-
2
votes1
answer120
viewsHow to know the View() call link. NET MVC
I have a controller with a view at the end to show details of a company. I am making a code that allows generating a url to the company details through the goo.Gl to be easier and enjoyable to…
-
2
votes1
answer924
viewsHow to create a runtime class?
How to create a runtime class, or Runtime, dynamically, from a Dictionary<TKey, TValue>, for example, with C#? Dictionary<string, string> dicionario = new Dictionary<string,…
-
2
votes1
answer1720
viewsHow to add columns and values in columns in a Listview at runtime?
I own a ListView listViewListaChamada and I am trying to add columns and values to the columns corresponding to my ListView listViewListaChamada, however I did not succeed. I created the function…
-
2
votes3
answers1098
viewsProblem with Padleft
I have a problem using the Padleft method. I need to put some zeros in front of a string, but I’m not getting it. For example: string value = "2001795"; string newValue = value.PadLeft(5, '0');…
-
2
votes4
answers2496
viewsDo not open more than one form at the same time in C#
I’m developing a system that’s practically a CRUD. My problem and the following: when I open a screen of my system, if I click on the menu to open again, it has two windows open, that is, if I click…
-
2
votes1
answer162
viewsWebmethod with Data Model
Good morning, I would like to receive a data model in a method of my webservice, what is the correct procedure for me to get ? I’m trying the code below but it’s not working. namespace UI.Web {…
c# entity-framework web-service entity-framework-6asked 8 years, 9 months ago Daniel Gregatto 1,054 -
2
votes2
answers113
viewsXML for Datatable
I’ve been searching on how to pass the data contained in an XML to a DataTable and found the following reply. Doubt: By doing so, the method theDataSet.ReadXml(theReader); is able to identify data…
-
2
votes2
answers547
viewsParse with quotation marks in the middle
I have in the database a column of the type varchar that takes a JSON. That column is the description of a company, but in 4 languages. The logic I have is the following: { "PT":"Descrição com…
-
2
votes2
answers316
viewsJSON function Does not return value
I have a problem, I would like to popular my Dropdownlistfor with the result of another Dropdownlistfor, for this I am using Ajax and Json, same concept they do when they want the result of State to…
-
2
votes2
answers379
viewsSHA512 encryption - XAMARIN
Good afternoon, I’m trying to encrypt a string with SHA512, in the [PCL] project, I’m not getting, can anyone show an example of how to do? The idea was to do something like: public string…
-
2
votes1
answer446
viewsSeparator of thousands
How could you put thousands apart into one textBoxFor()? Example: Value entered in View 1,321 ( The point is for visual ease only) controller would receive the 1321 value to insert into the base. My…
-
2
votes1
answer118
viewsRename column with Entity framework
I would like to know how I can solve the following problem. I have the class below: namespace CustomizandoCodeFirstMigrations.Migrations { using System; using System.Data.Entity.Migrations; public…
-
2
votes1
answer58
viewsHow do you make a form never disappear?
How can I make an invisible form just with the text appearing,without the buttons just a text,never disappear when selected another window? a print:http://prnt.sc/ehlx3i When I select another window…
-
2
votes1
answer2511
viewsConnectionstring property not initialized
I’m trying to create a register of categories, the registration worked all right, but when I do the location of the records added to the register always returns the same error: An unhandled…
c#asked 7 years, 7 months ago Luiz Paulo Alvim Soares 37 -
2
votes3
answers1108
viewsManipulating with Update Panel
I’m working with asp:button e asp:Listbox using the event of click of asp:button to popular the listbox. I am trying to manage so that there is no more postBack in the event of click button, but the…
-
2
votes2
answers1302
viewscall php function in c#
As by c# in Windowsformsapplication call a function from a php page and take the value from it, example: php page: function retornar() { $valor = "aa"; return $valor; } In case I would like to call…
-
2
votes1
answer1537
viewsDoubt with passing Parameter Asp.net MVC
Calling the controller is no longer calling the Actionresult (Solved) I have my view: @model IEnumerable<Generico.Dominio.TB_MENU> @{ ViewBag.Title = "Index"; } @Html.Partial("_navbarInterno")…
-
2
votes1
answer129
viewsDropdownlistfor in a for
I am trying to fill in with the selected value one DropDownList within a for, but it’s not working properly. What happens is that when the Action Index returns the model to a View, values are not…
-
2
votes1
answer594
viewsProblems sending e-mail Asp.net.mvc
The SMTP server requires a secure connection or the client has not been authenticated? [HttpPost] public ActionResult Index(string login) { try { var tbuscar = new UsuarioAplicacao(); var retorno =…
-
2
votes1
answer417
viewsUnity: How to navigate between two points on a sphere?
I need to create a navigation system between two points in a sphere, the problem is that as the Unity Navmesh does not work with spherical objects I have to calculate and manually position the…
-
2
votes1
answer528
viewsShow / Hide console in an application in c#
I looked for how to show/hide the console in a c# application in the English forums and could not find it. Looking at international I came across several solutions but I found one very easy to apply…
-
2
votes1
answer1116
viewsCreate buttons at runtime
I intend to create a small web game where the user will make the decision of the characters at runtime. At the moment I have the following screen: When the user clicks on the left button, for…
-
2
votes1
answer1246
viewsUpdate multiple records with Entityframework
Assuming I have the following appointment: UPDATE tb_foo SET idoso = 1 WHERE idade > 65 To carry out this same process in Lilli, I have IEnumerable<Foo> foos = contexto.Foos.Where(e =>…
-
2
votes1
answer27
viewsCheck if dynamic named file exists on disk
My program generates an XML file named after the following structure: C:/wayDosFile/Nameanob_data_nrdeelementosnoxml.xml At the moment, I’m every time I file and he has the nrDeElementosNoXML other…
-
2
votes2
answers368
viewsIs the calculation of RENAVAN correct? Can you improve something?
Hello, I am searching on the internet and found on that website a code in C# of how to calculate RENAVAM, I moved a little, but I can’t find anywhere that explains how RENAVAM calculus actually…
-
2
votes2
answers268
viewsTaking a partial name from a process
Is there any way that I can get a process that’s running under a partial name, like what happens to like in a survey SQL? 'Cause I ask this, I got one team viewer customized here for the company.…