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
votes2
answers546
views -
2
votes3
answers221
viewsHow I dynamically put and take out a href
I got this href: <a href="/UpLoads/<%# Eval("DsPathDocumento")%>" class="linkUpload"><%# Eval("NmTipoDocumentoDown")%></a> What I want is that I create a link only when I…
-
2
votes1
answer167
viewsHow to search for the record when the table has a composite primary key?
I have in my database the table t_command_control. This table has a composite primary key formed by the fields CD_STATION and CD_COMMAND. If the primary key was simple (only as a field CD_STATION) i…
c# entity-framework linq linq-to-entities linq-to-sqlasked 9 years, 10 months ago Eduardo Freire Jr 21 -
2
votes1
answer457
viewsInsert sub-total per page into a RDLC Report (.NET) table
I need to insert cumulative sub-total on each page of my RDLC report. NET, I am using a table to allocate all the values of the fields and their summations. The great difficulty is to insert the…
-
2
votes1
answer741
viewsManipulating Listview C#
I have a Listview that displays the data on the screen and has several rows and columns. For example: Cl1 | Cl2 | Cl3 L1 aa | bb | cc L2 ab | bc | cd L3 ac | bd | ce I wonder, if you have any c#…
-
2
votes1
answer412
viewsEntity framework with connection string via code
I am developing an application, and I need the connection string to be set in the code itself, because there can be no app.config file..
-
2
votes1
answer557
viewsHow do I insert any file extension into an SQL database?
I always worked attaching only images in my BDD tables, I remember that converted to MemoryStream and then to Byte and inserted... But I need to insert any kind of file extension in my database.…
-
2
votes2
answers167
viewsManipulating related data Asp.net and C#
I am developing an ASP.NET application, which aims to register events and add customers to these registered events, forming a customer list for each event. My question is this: In the Events table…
-
2
votes3
answers1047
viewsDo not allow typing space in maskedTextBox
In the windowsforms what is the simplest way to avoid typing spaces into a control maskedTextBox ?
-
2
votes2
answers4504
viewsHow to read xml with c#
I want to create an application for android with C# using Xamarin, it takes in a "database" xml some information and puts it on the screen, but I’m not able to manipulate xml. I need to search the…
-
2
votes1
answer327
viewsHow to pass a Querystring using Registerstartupscript on Asp.net?
I have this code in my code Behind: ScriptManager.RegisterStartupScript(this, typeof(string), Guid.NewGuid().ToString().Replace("-", ""), "window.setTimeout(\" $('#" + calendar.ID +…
-
2
votes2
answers1914
viewsHow to make Insert in tables with many relationship for many?
I’m having second thoughts about how I’m gonna do the Insert relationship n:n my tables are: Recibo Analise Analise_Recibo (recibo_id, analise_id)…
-
2
votes1
answer158
viewsEmpty variable by foreach
Values are not placed in my variable by foreach, which I do? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using System.IO; using…
-
2
votes1
answer309
viewsVS 2012 Bundles use or not use, that’s the question!
I’m starting in VS 2012 and between the changes appeared the bundles. I have some doubts: 1 - Is this approach worth using? Why? 2 - The bundles should even stay inside the tag ScriptManager 3 - I…
-
2
votes1
answer506
viewsWrite Listview in SQL Database using Entity Framework and C#
I am developing a sales desktop application using C# and Entity Framework and I am having doubts about recording the items entered in ListView in the SQL database. How to save inserted items to…
-
2
votes1
answer51
viewsHow do I use the VS Command Window?
How do I use Command Window? I have never used this tool to debug.
-
2
votes1
answer111
viewsAppcache in Asp.net MVC
I need to use the Html5 appcache to store some web pages. Before using MVC I simply did this regular expression to check if you are connected or not. var offlinePages =…
-
2
votes1
answer187
viewsHow to add a Label inside a Textblock by code Behind
How do I add these Labels within the TextBlock, for code behind? <TextBlock> <Label x:Name="NumeroPergunta" FontWeight="Bold" /> <Label x:Name="Pergunta" /> </TextBlock> What…
-
2
votes1
answer3190
viewsOpen MDI form and close one when opening another?
My question is, how do I open a form on an MDI and after opening another the previous one closes or simply MDI. I know this is not the right but it will give to understand what I want! Form Consulta…
c#asked 9 years, 9 months ago Johnatan Licar 51 -
2
votes1
answer1195
viewsHide Actionlink parameter
For example: /admin/Edit/1006 Is there any way to hide this id? So any malicious user can change the value and end up finding a user. I know you have to check the controller to see if the user can…
-
2
votes2
answers2419
viewsQuery with related data in the Entity Framework
I am trying to bring data of the materials with the data of your relationships with the Unit and TD tables, but this code below does not return anything, if I do without Include() it returns the…
-
2
votes2
answers230
viewsHow to verify if a file name has 16 digits?
namespace _06_Teste { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void cmdValidar_Click(object sender, EventArgs e) { foreach (String file in…
-
2
votes1
answer63
viewsHow to display the version of my website on all pages?
I want to display in the footer of all my pages the version on which my site is running. For example: Version 1.0 After I do an update on my website and publish it again would be something like…
-
2
votes1
answer151
viewsProblems creating DAO and an insert
I’m starting now with C# and I’m having some problems at the time of developing this code, I was aiming to create a DAO with a simple connection and then instance it and then insert it into the…
-
2
votes1
answer3790
viewsGetting objects with Jquery and sending via Ajax to MVC C#
I’m trying to understand how to receive HTML objects for a MVC C#controller. I know the code below works if the controller has string[] teste. <input type="hidden" name="teste"> <input…
-
2
votes1
answer318
viewsUse Inner Join with Bindingsource
I’m trying to make a query in an access bank using inner join along with BindingSource, this Binding will send the data to a Datagridview. However, when the data is loaded into the grid, the…
-
2
votes1
answer478
viewsConditional Sub-model Validation MVC 4 C#
I have the following problem (I will simplify the classes to facilitate understanding): public class Class1 { [Required] public int? Id_Estabelecimento { get; set; } public string Nm_Nome { get;…
-
2
votes1
answer1354
viewsText break in Windows Reporting (RDLC) column
I have a report that has the structure below: And almost everything works properly. But when the answer text of a question is too large (there is no character limit) the entire line (of the report)…
-
2
votes1
answer89
viewsRemove part of the time interval Kendo Timepicker
When using TimePicker of KendoUI to define a selection of service hours, the minimum period (8:00) and maximum period (18:00) was defined, but it will be necessary to remove the interval from 12:00…
javascript c# asp.net-mvc-4 kendo-ui telerikasked 9 years, 8 months ago Cristiano Ávila Salomão 353 -
2
votes1
answer3627
viewsPlace local image on body when sending email
To send an email from the application I am using the MailMessage available. I am now trying to place an image in the email body via html: MailMessage mail = new MailMessage(); SmtpClient SmtpCliente…
-
2
votes1
answer728
viewsGenerate PDF with specific source
I have a report that already works. I need to change the source to "Garamond" (already installed). The references found speak about other more flexible properties, with for example changing the…
-
2
votes3
answers226
viewsHow to use Getsetting/Savesetting in Windows Services
I created a service and configured it as Localsystem. In the implementation I try to search for a record saved on REGEDIT by another programme. The method GetSetting always returns me empty. Is…
-
2
votes1
answer4300
viewsRecover value from an HTTP query string
I have a URL where it returns an HTTP QueryString, and I need to retrieve the information from the URL and convert it into variables to make queries in the database. In PHP just use the $_GET[""],…
-
2
votes2
answers775
viewsProblems with Web.Config
I am having difficulty using several web.config on my system. In my web.config main i have the following configuration: <configuration> <appSettings> <add key="BASE_URL" value="/mvc/"…
-
2
votes1
answer91
viewsWhere can I find the Microsoft.WindowsMobile.Forms library?
I’m developing an application on Smart Device for Windows Mobile 6 in Visual Studio 2008 C#. In this application I need to use the object functions CameraCaptureDialog, because, the main goal of the…
-
2
votes1
answer570
viewsConversion of string to datetime with specific format
I have a string in the following format: 16Mar2009(mon), but I’m not getting to convert into datetime. string format = "dMMMyyyy(dd)"; DateTime dt = DateTime.ParseExact("16Mar2009(mon)",…
-
2
votes2
answers1201
viewsIdentify USB stick
I need the application to copy a file when a flash drive is connected. It has how to identify when the removable disk is connected and the volume name, so that the system does not copy to the flash…
-
2
votes2
answers265
viewsConditional Client-Side (Jquery) validation
Late! I am performing a complex validation on a specific class with the following code (reduced to simplify): public class Classe1 : IValidatableObject { [Key] public int Id_Classe1 { get; set; }…
-
2
votes1
answer327
viewsPlay youtube videos in a Windows Phone app
Hello, I am creating an app for Windows Phone 8/8.1 programming in C#, one of the features will be the possibility to watch youtube videos, but I could not make it work using Mediaelement. Is there…
-
2
votes1
answer641
viewsA little more about File.Writeallbytes
How to display progress by synchronizing the following function: File.WriteAllBytes(string path, byte[] content); This method should be called according to a System.Threading.Thread Ex: Thread wnd;…
-
2
votes1
answer119
viewsError writing to Mongodb using C#Parallelism
I have a collection on Mongo that has subdocuments, so I read xml files and write them to Mongodb. Each xml file is a document in Mongo. My classes public class Cabecalho { public Cabecalho() {…
-
2
votes2
answers91
viewsDebugging error in Visualstudio 2013
I’m not able to debug my programs, always appears this, already deletes the file . suo and nothing! Someone knows of a solution?…
-
2
votes1
answer519
viewsHow to block editing of a record when it is edited by another C#user
In a network system (Several using the same database), how do I know if any user is already editing the record. Because if in case two computers edit the same record at the same time, a problem…
-
2
votes1
answer641
viewsConstructor class Abstract
I’m failing to develop the following environment: public abstract class AplicacaoGenerica<TEntity> where TEntity : class { private IRepositorio<TEntity> repositorio; public…
-
2
votes1
answer1066
viewsExplanation about redirect loop
I p/ a meeting and will ask why have some data Redirect Loop. In the code, I put a false parameter and it has solved, but turns and moves it back. The question is: What is a redirect loop? What I…
-
2
votes1
answer285
viewsUsing Identity in an Asp.Net MVC 5 application with Web Api and vice versa
When I create a project Asp.Net MVC with Individual User Accounts i can get into the application this way: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password,…
-
2
votes1
answer4196
viewsHow to save a PDF file to SQL Server 2008 using C#
The database is prepared to store the PDF in a field of type VarBinary(MAX). How to read this field later?
c#asked 9 years, 7 months ago Daniel Domingos 21 -
2
votes2
answers1631
viewsMake a combobox take C#
I doubt to make the combobox assume a value. I have two combobox with the items 'low, medium and high' and I want that if I select low in the combobox it takes the value 0, if I select medium it…
-
2
votes1
answer430
viewsDatagridview windows Forms
I have the following question: I have one Grid which is composed of various information (id, city, zip code) and the user will select several lines in this Grid. I need to capture the selected…
-
2
votes1
answer4343
viewsQuery works in the database but not via code
using (var cnx = new OleDbConnection(new AdministradorDAO().conexao)) { var sql = @"insert into usuarios(matricula, nome, senha, nivel, maleta, email) values (@matricula, @nome, @senha, @nivel,…