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
-
0
votes1
answer837
viewsStarting a windows service
I am mounting a "Service Monitor". My windows server is stopping my database service. So I set up a service validator, but I don’t know how to give the start in the service again in case he falls.…
-
0
votes0
answers247
viewsUpload - the process cannot access the file because it is being used by another process
I am trying to build a file manager, but I am finding a problem when updating the file. First I do the upload file, and after that, if the user wants to update, I have the option to update, where…
-
0
votes2
answers1186
viewsEntity Framework: Object Update Error
I am unable to update my object. I created the method as follows: public void Atualizar(T obj) { banco.Entry(obj).State = EntityState.Modified; banco.SaveChanges(); } The following exception was…
-
0
votes1
answer82
viewsDatagridview loads data but displays blank
I have a Datagridview, it loads the data but does not display them. private void AtualizarGrid() { AlunoDAL alunoDAL = new AlunoDAL(); var bindingList = alunoDAL.CarregarAlunos(); AlunosColecao…
c#asked 6 years, 12 months ago João Víctor 75 -
0
votes2
answers118
viewsSeparate front-end and back-and from executable
My idea is to separate the application into three distinct files, in the file MinhaAppBackend.dll, will be, as the name suggests, all classes and other elements that are part of the back end of the…
-
0
votes2
answers702
viewsHow to extract file from an FTP directory?
Good afternoon, everyone, I need to extract the files that are in the FTP folders. Following the examples that are in these links:…
c#asked 8 years, 4 months ago Diego Farias 909 -
0
votes1
answer43
viewsDoubt - Project to the secondary screen and Form
Follow the event code click: //Estendido telaSecundaria = new SegundaTela(); Screen[] telas = Screen.AllScreens; Rectangle bounds = telas[1].Bounds; // pode ser outro índice.…
-
0
votes1
answer478
viewsExport Listview to Excel (.xls) from a list populated by LINQ, WPF project (C#)?
Good... I need to export the Listview data populated by the LINQ method of an SQL database... I’m not getting the Column Headers in Excel... Anyone can help? Reference:…
-
0
votes0
answers55
viewsProblem running webapp after reinstalling windows 10. Visual Studio 2013 Express for Web
After the reinstallation of Windows 10 and Visual Studio 2013 Express for Web a project that previously worked started to indicate the following error: Could not load file or assembly…
-
0
votes1
answer128
viewsMaskedtextbox Interactive for Mobile Phone Number
I have a Maskedtextbox on my system with the following format (xx) 9xxxx-xxxx for mobile phones that have the digit 9 more, but in some states do not have this digit more getting like this (xx)…
c#asked 6 years, 11 months ago João Víctor 75 -
0
votes1
answer190
viewsXmlserializer generates empty file space before closing tag
I am using the following code to generate an xml: public bool SerializarObjeto(object o, string pathArquivo) { var xns = new XmlSerializerNamespaces(); XmlSerializer writer = new…
-
0
votes1
answer101
viewsHow to identify which Tabpage is being closed
Good morning, how are you? I am working with Xtratabcontrol, and when I close a tab, I need to know which tab was closed. today at the event xtraTabControl1_CloseButtonClick, I’m doing it this way:…
-
0
votes2
answers448
viewsThe "Color.Name" property or indexer cannot be assigned, as it is read-only
Follow code where I define SegundaTela: public partial class Form1 : Form { SegundaTela telaSecundaria; } Code: telaSecundaria = new SegundaTela(); telaSecundaria.label_segunda_tela.BackColor.Name =…
-
0
votes1
answer100
viewsChange database instance
I am doing a project in MVC and my problem is that my database is automatically created in the "localdb" instance, but I wanted it to be created in my instance that I created in SQL Server. Is there…
-
0
votes1
answer198
viewsWhen using the constructor when using load
Good night, how are you? I have a question, when to use the constructor and when to use the load of a form to call some method or etc. Example: public partial class Manutenção_cliente :…
-
0
votes1
answer134
viewsAdo.Net and Entity in the same project
I took a test to do and it is mandatory to use Ado.Net, but it would be a differential the use of Entity. I’m a little confused about this. Ado.Net and Entity gives ball?
-
0
votes3
answers687
viewsBundleconfig.Cs is even needed
I’m reading something about MVC, Webapi and Angularjs. All the examples I got, whether from Macoratti or others ask to make some configuration in Bundleconfig.cs. However I use VS2017 and when…
-
0
votes1
answer438
viewsError while connecting to ftp using c#proxy
I have an application that connects to an ftp, but when trying to connect using proxy authentication I get an error. O servidor remoto retornou um erro(514). Proxy retornou um erro. This is the…
-
0
votes2
answers1436
viewsHow to center layout
I want to center this panel, even when the screen is maximized, I want it to stay centered. Not as it is.…
-
0
votes0
answers52
viewsHow do I access threadmain elements in other threads?
I’m with this mistake Threaded operation not valid: 'Lblcheck' control accessed to from a thread other than the thread where it was created. Task tarefa = Task.Run(() =>{ } .ContinueWith(t =>…
-
0
votes2
answers124
viewsStatic Datatable, how to load?
I need to create a method, that when the user logs into the system, when the initial menu is loaded, it loads a Static DataTable, so that I can use the DataTable, for some popular ComboBox, without…
-
0
votes1
answer196
viewsSelenium Web Driver Phantom JS c# Continue where you left off
I’m developing a robot in Selenium. However, this robot has a time that interacts with the user. However, I cannot make it continue where it left off. Let me give you an example: Pretend that this…
-
0
votes2
answers615
viewsHow to play something similar to CSS in Windows Form?
I would like to make a program with the same appearance/style as the site, but in Windows Form CSS does not work because it is a Web technology. So how could I do something like that?
-
0
votes1
answer119
viewsHow to project window2 on the secondary wpf screen?
Following is code (Mainwindow): using System.Windows.Forms; using System.Drawing; var win2 = new SegundaTela(); Screen s2 = Screen.AllScreens[1]; Rectangle r2 = s2.WorkingArea; win2.Top = r2.Top;…
-
0
votes2
answers3339
viewsSave image in directory without Savefiledialog
I am developing a stock control application and in this application there is a product registration screen: The images of the products are being saved in the Mysql database. I received some tips and…
-
0
votes1
answer204
viewsApplication . NET C# Nodejs express style
But for a few features I would like my project to respond to some simple HTTP Rest requests. As the project will handle COM+ and more, I will do it in C#. The point is, I don’t want to have to deal…
-
0
votes1
answer51
viewsHide column and change size. Gridlookupedit
I am using a Gridlookupedit, and I would like to hide the first column, and adjust the size of the others, however I am using gridLookUpEdit2View.Columns[0].Visible = false; and the…
c#asked 8 years, 4 months ago Thomas Erich Pimentel 3,059 -
0
votes0
answers43
viewsCompile multiple files
I have 3 settings: client.exe, client.dll, client.dat. Wanted to compile them into a single exe as Molebox does. I searched for Binder Files, I tried to put the resourcer from my application, but…
-
0
votes5
answers870
viewsDoubt with foreach com group by Asp.net mvc
I have an appointment with a group. public List<TB_POSSIBILIDADE> ListarTodos(int id) { var strQuery = ""; strQuery += " select "; strQuery += " a.IDPOSSIBILIDADE,"; strQuery += "…
-
0
votes0
answers208
viewsLog4net C# - does not save to database
I am using log4Net as a Log framework for a Winforms APP. public class Logger { private ILog _logErro; private const string LogErro = "LoggerErro"; public Logger() { Configure(); } private void…
-
0
votes1
answer139
viewsSearch/select database with C#
I have a form with a button and a simple datagridView, but my problem is that I have to search my file in ". mdb" (Access database) on the computer, so it will be shown in the datagridView then the…
-
0
votes1
answer209
viewsEntityframework 6: Doubt to Persist a Relationship N to N
Model: public class Agenda { public int Id { set; get; } public string Horario { set; get; } public string Local { set; get; } public virtual IEnumerable<Exame> Exames { set; get; } } public…
-
0
votes1
answer38
viewsPackages do not restore Nugetpackage
After upgrading VS2017 to version 15.5.1 this project no longer restores packages I tried to remove the packages and install again but it didn’t work, reinstalled the VS didn’t work out tbm,…
-
0
votes0
answers88
viewsShow Report Viewer Multi-value Parameter values
I have a question, as I can display all the recorded values in a Multivalore Parameter in Report Viewer (C#), I can display a value of a specific position (Parameters!Test.Value(0)), but I wanted to…
-
0
votes1
answer190
viewsRemove Null Item from a Combobox c#
Hello, I need to develop an advanced search filter. I created some comboBoxs for the keywords, but whenever I need to fetch the contents of a column that eventually has less content than another…
-
0
votes1
answer88
viewsPublishing system with Entity Framework 6
There is an executable installer for Entity Framework 6 for servers. I posted the system to a Windows server 2008, and it’s not working. Is returning the following error: Schema specified is not…
-
0
votes1
answer33
views'Game.Server.Gameobjects.Gameplayer' does not implement interface Member 'Game.Logic.Igameplayer.Addprestige(bool)'
Error: 'Game.Server.Gameobjects.Gameplayer' does not implement interface Member 'Game.Logic.Igameplayer.Addprestige(bool)' Code: public class GamePlayer : IGamePlayer { public void AddPrestige(bool…
c#asked 8 years, 3 months ago user39571 -
0
votes0
answers70
viewsEntity Framework 6: Error saving - Instances of Ientitychangetracker
Domain public class Agenda { public int Id { get; set; } public DateTime Data { get; set; } public string HoraInicial { get; set; } public string HoraFinal { get; set; } public string Local { get;…
-
0
votes1
answer229
viewsConnect to a local database c#
What is the correct syntax of Sqlconnection to connect to a local database? I think it’s something like this!! SqlConnection liga = new SqlConnection(@"Data Source=(LocalDB)\v11.0;…
-
0
votes1
answer639
viewsHow to take the path of the directory
I’m using Winform and trying to save a string with Savefiledialog but I can’t pass the chosen directory in Savefiledialog to the System.IO File function.Writealllines; private void…
-
0
votes1
answer4236
viewsMicrosoft Speech Platform in Portuguese
Dear people, I have an application using speech recognition that works very well in English (en-US), however when I tried to use for Portuguese (en-BR) the results are terrible, it seems like you…
c#asked 8 years, 3 months ago Matheus Lemos 103 -
0
votes2
answers82
viewsC# conversion of a private void to public void
Hello everyone I need to know how I can convert this code to public void. Visual Studio shows error in variable and. Error message: "The name 'e' does not exist in the Current context" I just did it…
-
0
votes1
answer228
viewsError in API Rest POST - Windows Forms
I’m trying to register (POST) this endpoint https://geradornf-prod.herokuapp.com/ (is a Simple API I made with Django Rest) I’m using Windows Forms C# Follow the call: using (var client = new…
-
0
votes0
answers316
viewsProblems with Jsonconvert.Serializeobject and Stringcontent
I am developing an application Xamarin Forms that will persist data via web service (PHP - Mysql), but I have problems sending data via POST I have the event below and the same from the message of…
-
0
votes1
answer102
viewsProcessing of text files
I am processing files .txt, however I process more than 1 file at a time, but in the database only saves 1 file, debugging I see that it reads and processes the 2 files, or up to 3 depending on how…
-
0
votes1
answer109
viewsHow to access the main thread from the main thread
I wonder if it is possible to call a method using a thread from another thread. The reason is that there are methods that can only be called from the main thread, and I need to call them in another…
-
0
votes0
answers135
viewsASP.NET and C# - Gridview line obligation
Just as there is in forms of ASP.Net sites the Requiredfieldvalidator, which requires the filling of a field, there is some way to have a mandatory gridview with at least one line? For example, I…
-
0
votes0
answers18
viewsMoving Cell from a Gridview C# desktop
This code does nothing more than drive a row selected on a datagridview. btnup -> plays the selected line up. butndown -> plays the selected line down. DOUBT: My question is, how to move only…
-
0
votes0
answers57
viewsInvalid report file path - Crystal - C#
I am trying to generate a pdf from the Crystal report. When I run the code on my machine works perfectly, already when I go up to the server returns me the following error: invalid report file path…
-
0
votes1
answer65
viewsEdit . txt using stream and a button
I have a form in c# and winforms, and I need that, when I click a button, it edits a . txt and add a line of text. Follow the commented code: using System; using System.Collections.Generic; using…