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
answer311
viewsLINQ Group By with multiple fields in key
How do I include the IdCategoria in addition to the category name in the Console of the first FOREACH? var lst = from p in BDProduto.produtos join c in BDProduto.categorias on p.IdCategoria equals…
-
1
votes1
answer320
viewsRandomization/Randomization C#
Boas. I’m trying to create a Snake game in c# and I have no idea how I can make a new fruit appear in a random place when the snake picks some fruit.
-
1
votes0
answers52
viewsWebservice VB passing parameters to C#
Good morning, We have two systems, one of them is in VB and the other in C# an identity manager (which serves to unify the login, we will put more systems inside it so that there is only one login…
-
1
votes1
answer196
viewsReport from Dataset created in a Class
How do I create a Visual Studio 2013 Report from a Datatable (or Dataset) created in a method? When searching for the Report.rdlc data source I refer to the class where Datatable is created, but it…
-
1
votes4
answers6317
viewsEmpty field and zero value check
Below are two examples of my codes, I have a text box weight that the user needs to put some weight, and can not be 0. In the first code below, he does the checking though, he runs the rest of my…
-
1
votes2
answers2222
viewsSocket UDP Send and Receive C#
I’m developing a c# application that uses UDP, the problem is that I can’t answer the customer. I get the following error: Additional information: A request for sending or receiving data was not…
c#asked 9 years, 7 months ago Pedro Soares 1,136 -
1
votes4
answers490
viewsStart connection to Signalr
I am creating a simple application for C# Signalr studies on VS2015. How do I start the connection without having to define a method in the client? I’m doing it this way: $.connection.hub.url =…
-
1
votes1
answer227
viewsError when filtering data from Datatable
I own a Viewbag where I populate a select with a list of years. When selecting a specific year, filter the table with data only from those years. To make this filter, I’m using a script:…
-
1
votes1
answer307
viewsHow to fill a code column for reference with repeated values
I have a query where I have returned several data of each user. However, when performing a search, I have as return the repeated data. I know that this repetition of the data happens because I do…
-
1
votes3
answers6139
viewsAn unhandled Exception of type 'System.Invalidoperationexception' occurred in System.ServiceModel.dll
I’m trying to consume a service but it gives the error: An unhandled Exception of type 'System.Invalidoperationexception' occurred in System.ServiceModel.dll And the message: "Could not locate…
-
1
votes1
answer364
viewsAn Object with the same key already exists in the Objectstatemanager. The Objectstatemanager cannot track Multiple Objects with the same key
Guys I’m having a bit of a problem, I’m trying to do an update using the Entity Framework, but when it arrives in Savechanges(), the following error appears. An Object with the same key already…
-
1
votes1
answer215
viewsC# set a condition for a column value in a Datagridview with Datasource
I’m using VS2013 Entity 5. The situation is as follows: In a table of Sons, there is an attribute sexFile that receives the value 0, 1. 0 for male and 1 for female. (could use "m" or "f", but it is…
-
1
votes1
answer230
viewsTransfer date value from Form1 to class c# windows form . net
I’m working with windows form . net c# but I don’t have much practice and would like a help... I have a calendar component in a Form1 and after running the application, a date is selected which is…
-
1
votes1
answer177
views -
1
votes1
answer344
viewsHierarchical Object Filter
I have an Asp.net MVC 4.5 C# Razor screen typed by a main class: public class ClassePaiDTO { public virtual ICollection<Filho1DTO> Filho1s { get; set; } public virtual…
-
1
votes0
answers327
viewsUpload PDF or P7S file to XML
I have the following XML line of an XML Schema. {**<nomeArquivoP7S><nomeArquivoP7S>**} and I want to include a file in p7s of name copia1.pdf.p7s in this line, that is I want to upload…
-
1
votes2
answers570
viewsIoc with Ninject
I am developing an application using Ioc and Ninject for dependency injection, and came across the following problem: When uploading my application to the server I got the following error: Someone…
-
1
votes0
answers32
viewsDbdatareader to read after a while
When the database is at the beginning, it works perfectly, after some time of use, the object does not return anything and the query does not work. This is the source: using (DbCommand cmd =…
-
1
votes4
answers630
viewsHow do I use the F2 key to open another form?
I have the following code, but this enabled the key ENTER (13) to open the form, I would like to enable the F2, I have already searched ASCII tables everywhere and can’t find the desired code.…
-
1
votes2
answers10665
viewsHow to get time difference between two Datetime variables in C#
I have two variables DateTime, which are Datacadastro and DataAtual(DateTime.Now). I need to know if the time difference between these two dates is greater than or equal to 4 hours. Is there any…
-
1
votes2
answers777
viewsC# Regular expression for string and Guid validation
(1). I would like to validate a string by checking that it only has {[a-z], [A-Z], [0-9], '-'} if(minhaString.ContemApenas({[a-z], [A-Z], [0-9], '-'}) == true) { // Minha string é válida! } (2). I…
-
1
votes1
answer428
viewsFileupload returning the same file from several selected files
I have a Fileupload that I select several files and I save in the directory, but I realized that his Filebytes, repeats equally in all files. if (FileUp.HasFiles) { foreach (HttpPostedFile…
-
1
votes1
answer1626
viewsMessagebox with autoclose
I’m having some problems with an application I created, using C# and Windows Forms, and the situation is as follows:: The app is a chat. It does not keep record of conversations; When the…
-
1
votes1
answer1100
viewsHow can I generate a delay while running an application in Unity?
I am creating an application in Unity and need some function that causes a delay during the execution of the application.
-
1
votes1
answer880
viewsHow to execute a method inside a textbox only if the user gives enter?
I am trying to execute a method within a textbox, only if the user gives enter. Check that I have to use Keypress, but I’m not able to apply. I want when the user puts the product code inside the…
c#asked 9 years, 6 months ago WesleyDSantos 76 -
1
votes1
answer217
viewsAES128/256 C#. net AND SQL 2008/2012 encryption
Greetings, Does anyone know of any AES compliant encryption implementation between c# and SQL? I want to encrypt in C# and decrypt in SQL.
-
1
votes3
answers821
viewsRazor - Send parameters to a Bootstrap modal
I have a list (grid) and want to open a modal bootstrap with details of the chosen line. To build the list I’m using - @foreach, and store the data in a viewbag. The idea is to open the modal window…
-
1
votes0
answers232
viewsHow to maintain the current state of Gridview with Detail jQuery after Post Back
I am using the following solution for my grid: http://www.aspsnippets.com/Articles/Build-Master-Detail-GridView-using-jQuery-in-ASPNet.aspx This solution makes a grid appear and unlearn as it is…
-
1
votes2
answers1247
viewsProblem inserting double value in Mysql
query += txtServidor.Text + "',";<br> query += double.Parse(txtVencimento.Text) + ",";<br> query += int.Parse(txtBanco.Text) + ",'";<br> INSERT INTO tbl_associados…
-
1
votes1
answer786
viewsGenerate PDF images using Pdfsharp -Windows Form
I am using window form . net and would like to convert scanned images to PDF thus generating images pages in PDF. I’m using the Pdfsharp. I have the following code but it only generates a page.…
-
1
votes1
answer86
viewsWebapi 2.0 - Apicontrollers in another Assembly do not suffer mapping if runAllManagedModulesForAllRequests="false"
I have an app Webapi2 that implements some Apicontrollers. This same application references a Assembly that implements some more. All of these controllers utilize Attribute Routing, as in the…
-
1
votes1
answer941
viewsHow to integrate a Mysql database with a C#application?
I’m a beginner in database and I have a simple C# application and I want to use the Mysql database to store the data. I have Mysql Server installed and usually use the "command-line client" where I…
-
1
votes1
answer3938
viewsIs Xamarin a viable option for mobile development?
I need to develop for mobile and I was thinking of Xamarin as an option, and then I went to do some research and found out that: The Xamarin is paid, and the price is half salty for a cheap…
-
1
votes1
answer175
viewsUsing variables from other sources (C#)
I’m learning programming with C#,using visual studio 2013. In this program I have two windows. In the first window I have a text box and a button that saves the text in a string and opens the second…
-
1
votes0
answers1347
viewsAutomatically log into a web-site c# Programmatically
The company where I work has 3 websites both with login and password I would like to know something in c# NET or Javascript that is from a redirect link logged in. 1 Step: Access Site 1…
-
1
votes1
answer98
viewsPlay Query Dice For Datagridview in C#
Hello guys I’m facing problems with a listing. I have a Datagridview loading a list of products automatically and a combobox with the names of the categories, the idea is that when selecting a…
-
1
votes1
answer241
viewsGrab value from a button inside 'Contentcontrol'
I have the following code on XAML: <Button Grid.Column="0" Grid.Row="1" x:Name="btnSete" Click="btn_Click"> <ContentControl> <Viewbox Margin="3"> <TextBlock Text="7"/>…
-
1
votes1
answer61
viewsLoad view by parameter
How do I call a view by passing a parameter? Type, if parametro = 1 <h1>Teste1</h1> else <h1>Teste2</h1>
-
1
votes2
answers187
viewsDoubt about using in Visual Studio
I create a new project but can’t put those using as in this example below. He appears as in the other code below... Help me please =/ using System; using System.Collections.Generic; using System.IO;…
-
1
votes1
answer116
viewsCustom Element Web Forms
How can I make a custom element in aspx that I inherit DropDownList? I wish the element would stay that way when I call it: <componente:DropPersonalizado runat="server"…
-
1
votes1
answer90
viewsRead/Write information to file . cds
I took a project to develop in C#, the project is based on reading information from a file .txt and save the information to a file .cds which is used in a system developed in Delphi. I looked for an…
-
1
votes2
answers599
viewsSQL to bd connection on the network
I developed a C# application that uses SQL Express that initially the bd and the application were installed on a single machine. The client now needs the comic to be available from another computer…
-
1
votes3
answers2414
viewsHow to byte[] a uploaded file into a C#Uploadfile
In the past I was able to pick up the file path through the component, but now after researching I discovered that it is no longer possible to pick up the file path in the client for security…
-
1
votes0
answers143
viewsC# :Zxing Variation of the first number?
People I developed this barcode reader in C# using Zxing , it reads the barcode of an img and then it takes the image number , moves the image to another folder and renames the image with the…
c#asked 9 years, 5 months ago Yuri Ancelmo 353 -
1
votes2
answers3120
viewsThe name 'parameters' does not exist in the Current context
I have the code below and is giving the following error: The name 'sql' does not exist in the Current context The name 'parameters' does not exist in the Current context Can someone please help me?…
-
1
votes1
answer244
views -
1
votes1
answer638
viewsSave item in Combobox
I have a combobox with some items added via form, by the property Items (Collection). I wish I could leave it to the user to type new texts in this combobox, which in my case, is a combobox of…
-
1
votes1
answer145
viewsHow to start a Consoleapplication that manages all database objects equal to Codefirst
Hello! to All I am starting a Console Application project in C#, I have read a lot about Entity Framework, Code First, Migrations. The purpose of this project is to generate all the tables of a…
-
1
votes1
answer686
viewsProgram that opens Notepad in the background
I need to make a program that, when the user presses a button, the program opens the notebook and insert a message previously programmed by me in the code. How could I make the program part insert…
-
1
votes4
answers3646
viewsCapture selected value in grid checkbox
Hello, I have the form above where it shows all the products I have registered in my database and presents in a Gride. I put inside this Gride the option to select (checkbox). I would like you to…