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
answer163
viewsSearch email in the database by name
I have all the clients inserted in listbox1 but I just want to select a few, and those go to the listbox2. In the listbox2 I have the customer id and name, and when I click on the "send email"…
c#asked 9 years, 4 months ago Fabio Gonçalves 85 -
2
votes1
answer4742
viewsError runat=server when inserting a button into the form
I have this problem that when passing the login form it gives this error: [HttpException (0x80004005): Controle 'Button1' do tipo 'Button' deve ser inserido em uma marca de formato com…
-
2
votes1
answer29
viewsUse Where Enclosure when class is dynamic
I have a base class: public class MinhaClasse<T> : Controller where T : class { public List<T> BuscarVarios(string nome) { return db.Set<T>().Where(/*?????*/); } } How do I use the…
-
2
votes1
answer541
viewsWhy isn’t my CONTROLLER picking up VIEW fields?
I am making a form in the VIEW, but the fields where I use radio and select(option) are not passing their values to the Controller. If anyone knows why. My view: @model…
-
2
votes1
answer34
viewsWhat is the use of variables of type Int32rect
I downloaded a project that works with images and in some cases it uses variables of this type, I did not understand what the purpose of this type of variable in image processing.
-
2
votes1
answer1118
viewsAutomatically save to Default Folder C#
Can someone tell me the C# method for saving a document to a default folder in Code? In this case wanted the program to automatically save itself to the Desktop. This is the code I currently have on…
-
2
votes0
answers575
viewsView word/pdf document in browser
Hello, gentlemen. I need to view documents saved in format, Word and PDF browser, however the user cannot print. This format can be for example in html or flash. I found this project…
-
2
votes1
answer220
viewsImage in WPF menu with C#
I have a problem, I created an application in WPF, and put a menu that will have images in the items. When I preview the image in VS is ok, but when I run the application the images do not appear.…
-
2
votes1
answer54
viewsPOST on Azure Webapi generating Timeout
I have a Webapi hosted on Azure, but when there are many POST requests, Azure returns timeout (the first two only works on average). Someone’s been through this trouble before?…
-
2
votes1
answer236
viewsHow to use in @Html.Checkbox?
I have the following code: @{ var st = //(minha lógica q retorna bool); } @Html.CheckBox("MeuNome",st,new { id = "MeuID", value = "MeuValor" }) I can’t use the variable st in the second parameter of…
-
2
votes2
answers89
viewsConvert PDF To SWF FLASH - Asp Net MVC
Good evening, I am generating pdf using Itextsharp and need to send to the client a swf, however I am struggling, in the client is a blank flash screen. I am using this strategy because with flash I…
-
2
votes1
answer623
viewsChange color of the Cell
I need to change the color of the cell: I’m doing it this way dataGridView.Rows[rowIndex].Cells["nomeDaColuna"].Style.BackColor = Color.Yellow; however I can’t get past the rowIndex I would have to…
-
2
votes1
answer277
viewsI would like a brief explanation of how to fill a combobox in MVVM standard
I would like a brief explanation of how to fill a MVVM standard combobox. The three parts, Model, View and Viewmodel filled with the table of the Database. Model: class Racas :…
-
2
votes2
answers40
viewsFiledialog doubt c#
Good, I have the following code in my program: CODE private void button1_Click(object sender, EventArgs e) { openFileDialog1.Filter = "Ficheiro de Configuração (*.cnf)|*.cnf|Ficheiro de Request…
-
2
votes1
answer111
viewsDoubt about JOIN of LINQ
Is there a right order to use Join? For example, I have two lists: Categories and products, should I first use the from clause with Categories or Products? And then in Join? Example: var stockQuery…
-
2
votes1
answer138
viewsWhat does "Inconsistent modifiers style" mean in Resharper?
Resharper is suggesting the following change in code: Obs: To classe Pagamento has public methods. Why the suggestion internaland not public?…
-
2
votes1
answer780
viewsHow to capture an error occurring on a webapi server?
I have a server where runs a Webapi service, in the client I run the call to a POST URL so: try { HttpWebRequest request; request = (HttpWebRequest)WebRequest.Create(URL); request.Method = "POST";…
-
2
votes3
answers352
viewsClose the panel when the mouse exits from the top
I have a Panel in a Form wherever the Panel is smaller than the Form. Here’s what I need to do: when the mouse is off Panel the same must be closed as I could do it? Note: I am trying to do this in…
-
2
votes2
answers576
views@If inside a <body> tag
How to put a condition if within a tag <body>? While trying to make: @if (Request.Path.Substring(Request.Path.LastIndexOf("/") + 1).ToLower() == "default") { <body class="home" } else {…
-
2
votes1
answer911
viewsProblem when deleting image
I have an image that is my user’s avatar, then I need to delete and I have the following code snippets: Action that is used in file import public void MinhaActionParaImport() { var arquivo =…
-
2
votes1
answer85
viewsWhat is the best alternative to recording data using a 3G connection?
I have the following situation: a header table with the fields: IDJOGO IDMODALIDADE IDUSUARIO VALOR_JOGADO HORA_JOGO And a detail table: IDJOGO NUMERO_JOGO In this case, it would be feasible to…
-
2
votes1
answer66
viewsHow to register dependencies with Windsor that are in different layers of the application?
How to register dependencies with Windsor that are in different layers of the application? I don’t want to keep referencing all layers of the application in the presentation layer as most do around.…
-
2
votes2
answers1060
viewsSend email Login & Password C# windows Form
I saw that I had to send e-mail when the user forgets the password and I put together different codes but all gave errors. I think there’s something missing and I wonder if someone could help me?…
-
2
votes1
answer141
viewscreate custom mask
How do I create a custom mask for a particular field? The mask will be in the following format: ____OB_____ (4 numbers + OB + 5 numbers) The image below shows the example I want to follow:…
-
2
votes1
answer331
viewsMVC C# How to force SSL - too_many_redirects
I am trying to force SSL use of my MVC WEB application. I’ve tried with redirect on the global wing, but it goes into too_many_redirects lopping. protected void Application_BeginRequest(Object…
-
2
votes1
answer177
viewsAuto reconnect reusing an async socket connection
How do I get my socket to reconnect itself when the connection is lost? Preferably reusing the same connection.
-
2
votes1
answer465
viewsconcatenate files in c#
Good morning I have several txt files in the same directory milestones-1, milestones-2..., only that I need to create a file only. but with an aggravation that each file will be a column of the…
c#asked 8 years, 9 months ago Marcos Paiva 21 -
2
votes1
answer729
viewsSearch data from related tables
I know that to return the values of a directly related entity in the bank is done so with LINQ: List<Usuario> lista = banco.Usuario.Include("Tipo").ToList(); But how can I get the data from…
-
2
votes1
answer244
viewsMethod to take life of the Player does not work
I’m making a script for take the player’s life when something collides with it, I’ve reviewed the code dozens of times and can’t find the error. The collision code is tied to the enemies:…
-
2
votes2
answers1154
viewsUsing distinct with Entity Framework
I have an object with a structure something like this: Date Description I’m thinking a distinct() in the description field because the records are ridiculously repeated. The question is, the…
-
2
votes1
answer69
viewsDoubt in the study of the Code First development approach
Galera I am studying the development approaches used in Entity Framework 6 the approaches Model First and Database First found good content easily on the internet and I was able to understand , but…
-
2
votes1
answer763
viewsDisplaying Modal with model passed inside a C# Asp.net MVC foreach
I have a main page containing a list of users. In this list of users I have a button on the side where I will click and display a modal, passing the model of that line I clicked. I managed to do it…
-
2
votes1
answer157
viewsFtpwebresponse.Getresponsestream returning an HTML
I am performing FTP connection, with the FtpWebResponse of c#. So far so good, I’m listing the directories as per this answer. When I simulate an FTP server locally with Filezilla Server included in…
-
2
votes0
answers951
viewsUpdate object of a serialized file
I am having difficulty updating the amount of a recovered object in a list of a serialized file. private void button1_Click(object sender, EventArgs e) { Estoque produtoEstoque = new Estoque();…
c#asked 9 years, 4 months ago Diogo Gonnelli Dos Santos 21 -
2
votes1
answer137
viewsIs there a free algorithm to check syntax C#?
I’m creating a small text editor that has C#code. There is some way inside the program itself, independently, to check if the syntax is correct? Note: I am not using C# to do the text editor. I am…
-
2
votes1
answer439
viewsOpen files from certain extension on my program
I’m making an application in Visual Studio, with the intention of it work with own extension files (.rmt, subject to change) and can open it later. I want that when the user double-click on the…
-
2
votes1
answer481
viewsAjax.Beginform returning Partialview as View
Goodnight! I’m working on a Bed Management project. In a particular View, I am displaying the registered Wards, and for filtering purposes, a field where one can research by the name of the…
-
2
votes1
answer399
viewsCommunication between Forms
I have a form that has a text editing component(RichTextBox) and create a search form (Find/famous CTRL+F). My question is how do I make one form "chat" with the other. For example, type something…
-
2
votes0
answers47
viewsAre there large differences in the "binary recording" of a file, when entering lists or dictionaries?
I’m developing a language project C# where I need to use files to store the data circulating in the data structures. Turns out I had the whole project all worked out, I wasn’t layering. I was…
-
2
votes1
answer267
viewsGet data from a column in the database for a variable
In one part of my code I have the treatment of an exception that uses this message. //Grava log com sucesso da importação fundo.registerLog(Resources.MensagemSucessoImportacao); The message is…
-
2
votes2
answers413
viewsProblem with String.Split
My problem is this: I want to get different objects from one string, dividing them by the character ;, except those in parentheses. Example: Linha1; Linha2; L i n h a 3; (linha que não quero que…
-
2
votes3
answers131
viewsLINQ Anonymized Type as parameter
I am trying to create a method that receives an anonymous type (LINQ query) (Please correct me if the term tipo anônimo (anonymous types) is incorrect) MinhaLista (produtos.Select(p => new {p.Id,…
-
2
votes1
answer74
viewsAttach many objects with id = 0
Good morning Personal, In my system here at work I have the following architecture: A PROJECT (which has some information) is composed of several PARTS. The parts are very different from each other.…
-
2
votes1
answer92
viewsHow to bar the registration of an already registered user
I am developing an application that manages Courses in Asp.net MVC, I’m still a beginner, and I’m trying to do the following: The Student has a screen where he lists all the courses for him to…
-
2
votes2
answers179
viewsPhoto saved in Directory does not appear in Solution Explorer
After a lot of pain, be able to save the photo in the directory and not in the bank. However it does appear on my tablet there in my Solution Explorer, more when opening the photo by windows explore…
-
2
votes2
answers347
viewsSending Text from an Enum display by Json
Guys, I’ve got an Enum for days of the week, being: Segunda = 2, [Display(Name="Terça")] Terca = 3, Quarta = 4, Quinta = 5, Sexta = 6, [Display(Name = "Sábado")] Sabado = 7 So I build an object that…
-
2
votes1
answer404
viewsProblem with Entity Framework Relationship
I am having problems in the relationship of my bank, I am developing an application that manages Courses, I am still beginner in Asp.net MVC. I have two tables Pupil and Course, and I have another…
-
2
votes2
answers1229
viewsScroll through a table (grid) Razor MVC
I have a table that is filled by a Model in HTML Razor in a partialView, a field of that table I left as editable using the @Html.TextBoxFor. After the user edit this field need to update in DB, but…
-
2
votes1
answer328
viewsHow to convert multiple images. jpgs to a single pdf file in c#
What I have is a directory with for example 10 scanned images.I would like to read these images in this directory and convert them into a single file .PDF.I know that there are Dlls in the market…
-
2
votes2
answers704
viewsEntity - Disable Lazy Loading?
I am at the beginning of project development. This project will have a large database. Is it advisable to keep Lazy load enabled? I’m worried it will lead to loss of performance.