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
answer1122
viewsBest method to locate values in a Datatable
In a unit of measure registration screen, I have to check if the unit that the user is wanting to register, if it already exists, then as I have a DataGrid populated by a DataTable, I thought I’d…
-
1
votes1
answer933
viewsXML deserialization
I have a method that makes a query to a Webservice, with the return I do a deserialization of the received XML. It turns out that if I do the desirialization in memory it gives a mistake saying:…
-
1
votes1
answer165
viewsDifferences between Xmlreader, Streamreader and Stringreader in desiccation
I asked the following question here at stackoverflow question link. During deserialization depending on the stream used, an error may occur in the XML namespaces, depending on the question link.…
-
1
votes3
answers1121
viewsFormat line with itextsharp
How can I build a line with different itextsharp formatting? I tried that way: Paragraph paragrafo = new Paragraph(Texto, new Font(Font.FontFamily.COURIER, tamanho, estilo)); doc.Add(paragrafo); But…
-
1
votes1
answer501
viewsHow to hide items from a C# MVC template menu?
I am having difficulty in being able to restrict access to some menu items of my application, because there is a type of user who will have access only to certain items and the Admin user after…
-
1
votes1
answer48
viewsCan I run a . NET Native image directly?
I built my executable in C# for an image. NET Native using ngen.exe, I have the file location, but when I run Windows says the executable is invalid. My goal was to make my application written in C#…
-
1
votes1
answer905
viewsHow to count repeated words in a string and find your position?
Imagine the alphabet, in this alphabet there are words from A-Z, but suddenly there are several letters A, like: To-B-C-D-E-F-G-H-I-To-J-K-L-To-M-To-N-O-P-Q-To The variable nomes below, is this…
-
1
votes1
answer233
viewsIs there any way to compare all received parameters?
I have the following method public Boolean Teste(String nome, String telefone, String...) { if(!string.IsNullOrWhiteSpace(nome) || !string.IsNullOrWhiteSpace(telefone)...) {} } There is how to…
-
1
votes1
answer118
viewsDisplaying welcome message at navbar!
I’m doing an app on MVC Asp.net. When the user logs in I would like you to display the welcome message bringing the user name, however you are bringing the email, as I change this? My action is that…
-
1
votes1
answer221
viewsBlock typing Textbox field with Calendarextender
Good afternoon, I need to block the typing of the date in a field Textbox Asp.net. It can only receive the date selected in the Xtender application to the Textbox. Would someone have some way via…
-
1
votes1
answer613
viewsHow to select using LINQ with 2 tables?
This is my select: bd = new AcessoBancoDados(); bd.Conectar(); string cidade = "SELECT c.Nome FROM Cidade c join Estado e on c.EstadoId = e.EstadoId WHERE e.Sigla = '" + dto.Estado + "'"; dt =…
-
1
votes1
answer58
viewsHow to work with more than one dropdownlist to mount a C#URL?
I have the following dropdownlist where in the first person chooses whether to rent or sell immovable. The consultation in the bank is being done as follows: public List<Imovel>…
-
1
votes1
answer191
viewsLoad a Gridview with selected records
How to load a Gridview into the webform with a few lines already selected ? I’m trying the following code but without success... protected void BindGridAcesso(int idSenha) { Usuario usuario =…
-
1
votes1
answer1369
viewsHow to browse a Dataset based on the data contained in a Datagridview?
I need to fill out a datagridview which already contains the list of all items. This is based on the records of material movements in a DataSet. The datagridview already has all items, for example:…
-
1
votes2
answers75
viewsSyntax error no for?
Error: (only assignment call increment decrement and new Object Expressions can be used as a statement) I do not understand why you are giving this error, being that the variable is of type int...…
-
1
votes1
answer113
viewsEntity Framework 6: Removal method does not work
I’m trying to delete an object using the Repository Pattern, but the problem is that when calling the method for removal nothing happens, nor throws exception. Financeirocontroller.Cs: [HttpPost]…
-
1
votes1
answer558
viewsList of all files that are within the Resource.Raw folder
How to get all the files that are in the Resource folder and move to a list. I am doing it manually, but now I need to take it dynamically and move to a list all the files that are in the…
-
1
votes0
answers25
viewsUsing the Xamarin Live Player
I can’t run Xamarin Live Player. The live screen After loading the live screen, scanned the qrcode and insert in editbox After all this, nothing happens…
-
1
votes0
answers127
viewsMysql Database does not connect with Entity Framework
Galera to trying to connect a Mysql database with c# through the Entity Framework, but every time I click on the next button comes to nothing(with Sql Server goes the problem is with Mysql)…
-
1
votes1
answer997
viewsAccentuation problem in postgresql with npgsql
I have a database postgresql raised with encoding SQL_ASCII and template0. When I try to select lines with accents like NAY gives error, but if the records have no accent works normally. Mistakes:…
-
1
votes0
answers280
viewsAdd field of decimal type Entity framework
I have a Repair table in it I have Valuemade, Value and Total Value all of the decimal type. The Value field = Valuemaod + Value Library. However this returning 0. I am showing this in the Detail…
-
1
votes1
answer108
viewsLib dependencies in C#?
I’m making a C# lib to use in my projects and not always have to rewrite. but as I do with Lib dependencies? Example: I made a lib to use Google Drive and has the name lib.GoogleDrive but you need…
-
1
votes3
answers100
viewsConvert decimal to ushort
I need to convert a value decimal for ushort in my application: Is there such a possibility? If yes, how to convert? I tried to use the Convert.ToInt16(value), but it didn’t work. Console example:…
-
1
votes1
answer506
viewsFill in Combobox without repetitions
I’m trying to fill one ComboBox from a db, but the ComboBox is filled with many repeated items! OleDbConnection Con = new OleDbConnection(); Con.ConnectionString =…
-
1
votes0
answers64
viewsUnwanted message when displaying notification on desktop
Hello, I am displaying a notification on desktop, but below the message appears "vshost32.exe". I would like to know how to remove this. Obg. My code: notifyIcon1.ShowBalloonTip(10, "Lembrete ", "…
-
1
votes1
answer86
viewsWhat is the difference between Toolbar.axml and Tabbar.axml?
I’m starting to work with Xamarin at Visual Studio 2017, and some things have changed. In the part of android when I go in layout I come across the two files Toolbar.axml and Tabbar.axml, I wonder…
-
1
votes1
answer54
viewsHow to use areas only using root controller
I created an ASP.NET MVC 5 project where I had done one template, so now we’re going to have several templates divided by areas. Only that the controllers will be the same, so I didn’t want to…
-
1
votes2
answers323
viewsSyntax error in SELECT WHERE using ADO.Net parameters
Someone understands this mistake and gets a solution? Code: OleDbConnection ConSelect = new OleDbConnection(); ConSelect.ConnectionString = Properties.Settings.Default.dbInvoice; ConSelect.Open();…
-
1
votes2
answers123
viewsProperty with private set
There is a difference between declaring the set private or simply omitting it? public int UmaPropriedade {get; private set;} public int OutraPropriedade {get;} The two lines of code are equivalent?…
-
1
votes0
answers23
viewsReturn inside the control does not send to the right maproute
Good afternoon, I’m trying to use maproute to control editing and inserting data in the table, currently my routeConfig is like this: public static void RegisterRoutes(RouteCollection routes) {…
-
1
votes2
answers2506
viewsHow to send and receive image by json?
i made an app in Xamarin that the person will have to sign and I need to send this image to the server If possible leave the code to perform such task
-
1
votes0
answers111
viewsDoubt with hangfire.io, (BACKGROUND PROCESSING)
Dear friends, I am using www.hangfire.io for background processing in my system, so far without problems, but it weighed a doubt. If Jobs are running, and I publish a new version of the site, what…
-
1
votes1
answer53
viewsHow to inhibit textbox but display ID data
I would like the Textbox ID to be inhibited (I don’t want to be invisible) but to display ID data that is saved (autoincrement) in the database. I’m using Visual Studio 2015 Community. Example: I…
-
1
votes1
answer95
viewsPerforming a query C#
I have a controller where I make a Select to get a list, but it returns empty. public IEnumerable<Check> GetUserByNumberOfregistration(int numberOfregistrationUser) { CheckContext contextObj =…
-
1
votes1
answer466
viewsHow do you recover data typed in Gridview and then save to the database?
In a certain register screen, I have a GridView with a few blank lines, then the user would have to type the information in those lines, and then when clicking the save button, do the INSERT at the…
-
1
votes1
answer321
viewsMVC5(Asp.Net4.5.2)- Redirecttoaction does not work in a single case
In my Account controller, in Action Login, I have the code below: case "Sucess": string rule = CheckRule(model.username, model.Password); Response.SetCookie(SetAuthCookie(model.username,…
-
1
votes1
answer73
viewsPass a list to a view to get via Javascript
I have a method Index, where it takes a parameter, makes a query and returns a list. I need to run that list along with view or get that list some other way, so I can access list via Angularjs.…
-
1
votes2
answers368
viewsChange the Foreground of certain items in a Listbox, via Style, using a Converter?
I have a ListBox where the data source is a ObservableCollection<string>. I would like the items that start with "ATTENTION" to have the red source. I could do it using one DataTemplate, one…
-
1
votes1
answer74
viewsHow to make Numericupdown return to the minimum value when Upbutton is clicked and the current value is the maximum?
I’m wearing a NumericUpDown in an application where the user can set a desired time for any action to be performed. There are three NumericUpDown: one for the hour (from 0 to 23), another for minute…
-
1
votes1
answer74
viewsProblems starting IIS Express via c#
I need to start IIS Express via C# with WPF. I can even upload the site and navigate, but only for a few seconds. Logo the site stops responding to requests, and only return reply when I close the…
-
1
votes1
answer119
viewsInstantiating the database context in the controller
Hello, I have a question related to the Dbcontext instantiation mode in the controller. What is the difference between the two methods below instantiation ? 1. private ApplicationDbContext _db;…
-
1
votes1
answer55
viewsRollback Sqlserver recording two separate tables
Premise: I’m using Entityframework6 for data persistence in Sqlserver. In a certain period I need to record data on two different tables, but the second table is dependent on the first example. try{…
-
1
votes2
answers317
viewsHow to make a Transform. Smoothed translate() in unity5?
I need to move one GameObject to any destination, but the transition must be smooth at a constant speed such that it lasts the time that is passed by parameter. For example: void Move(GameObject…
-
1
votes1
answer57
viewsInsert welcome screen into the project
How do I insert a welcome screen with a button to continue and open the system? in the incial form is so: namespace App_Herois_da_Fe { public partial class Form1 : Form { public Form1() {…
c#asked 6 years, 9 months ago Fabio Aragão 135 -
1
votes2
answers266
viewsHow to use Distinct() or Groupby() in a list that returns an anonymous type?
I’m doing a select on the bench to bring the IdNavio and Navio, but I don’t want to bring the repeated. I’m trying to use the methods Distinct() and GroupBy(), but they’re not working, I’m using the…
-
1
votes1
answer235
viewsSelect with Entity framework in N : M with multiple objects
I have the following classes: Client, Contact, Phone, Campaign and Campanhacliente. Where Campanhacliente, has a campaign, has a Customer ( who has a phone list and a contact list and who may have a…
-
1
votes1
answer75
viewsPython language format function in C#
int varvalor; int var01 = varvalor * 1; Console.Write("Digite um número para ser multiplicado: "); var01 = Convert.ToInt32 (Console.ReadLine()); Console.WriteLine(); I wanted to write on…
-
1
votes1
answer395
viewsWhat is the difference between Table and Matrix and List in Report View?
So far in my reports I have been using tables and I link my datasets to those. But today I needed to use a List to create a card (I’m still trying to understand how it works). When to use Table,…
-
1
votes1
answer1858
viewsPopup when right-clicking mouse
I’m trying to make a popup by right-clicking a mouse inside a GridView. I’m using the event MouseDown and the event MouseUp to do the popupControlContainer appear and disappear. but how to make it…
-
1
votes0
answers386
viewsError 'Microsoft.CSharp.Runtimebinder.Runtimebinderexception' in System.Core.dll
I am trying to debug a C# application and is showing this error: Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll 'Emulador AFO.vshost.exe' (CLR…