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
votes3
answers527
viewsDo I need to use "Convert.Toint32()" for text?
I think it’s something with the Convert.ToInt32(), because I didn’t understand its function inside the language. Observation 1: The place where I learn is American and I don’t know much English.…
-
1
votes1
answer800
viewsTransparent image and background color
I have the following code: FileStream fs = new FileStream(@"\path\imagem1.png", FileMode.Open, FileAccess.Read); Image image = Image.FromStream(fs); fs.Close(); Bitmap b = new Bitmap(image);…
-
1
votes1
answer111
viewsAutomatic view of a selected Row
I have a spreadsheet where I can upload numerous records, and I also have a field to search for any record. When I look for a particular record and the system finds this ROW it is automatically…
c#asked 7 years, 9 months ago Maurício Sanches 487 -
1
votes1
answer89
viewsHow do the text of a cell occupy two lines within the same cell in Crystal Reports with C# winForms?
I’m creating a report with Crystal Reports. It’s working, but it has the following problem: When the content of the cell is larger than its space, a part of the content does not appear. How do I…
-
1
votes1
answer607
viewsHow to open a local file with Xamarin?
Using Xamarin with Visual Studio and C#, I made an Android application and am creating a player using VideoView. I wonder how to access the mobile folder that contains the video. For example:…
-
1
votes2
answers554
viewsTaking information from a select and passing an array
I want to take all the fields of one select and store them in a array. I thought I’d do it this way, but it didn’t work. var lista = []; lista = $('#Model').text(); $('#Model').append('<option…
-
1
votes2
answers55
viewsBest Way to Implement Dataannotations
There is some difference in the following implementations? [Required, StringLength(150, ErrorMessage = "Insira no máximo 150 caracteres")] [Index(IsUnique =true)] public int MyProperty { get; set; }…
-
1
votes0
answers146
viewsHow to create a type of "DIV" in Xamarin Forms
How do I create a component that looks like a div in Xamarin Forms ? I need to create something inside that will have some labels with information referring to the user’s address, and will be…
-
1
votes1
answer49
viewsInclude Default XML namespace
Srs(as), good morning, I am generating an XML from the serialization of a class.Cs(schema) and the output is created xml (first example) . This will be exported to an external system, however they…
-
1
votes1
answer109
viewsproblem with Dynamic proxies ASP . NET MVC
Could someone explain me a method not to pick up the proxies from the Dbcontext and yes the real objects? Following a case: public ActionResult PegarItem(int anuncio, String remetente, int…
-
1
votes1
answer876
viewsIs it possible to pass the value of a Javascript variable to a C#variable?
The idea is to use javascript to detect the screen resolution, and take the value of the variable of this javascript and pass to the variable of C#. The only thing that’s crossed my mind is creating…
-
1
votes2
answers369
viewsHow to change project type on Github by Visual Studio
Well, I created a Reposótirio in the Github through the VisualStudio However, only when giving a Commit/Push he got the kind of project being JavaScript: But I want to change him to be the type C#.…
-
1
votes1
answer144
viewsAssert.Areequal() fails when everything seems to be right
I can’t find any errors in my Bubble Sort algorithm. But the assert returns error. I’m passing wrong arguments to the Assert.AreEqual()? //The method for testing public static int[] BubbleSort(int[]…
-
1
votes2
answers141
viewsSelect with Linq set the first characters in Where
How can I define in Linq the same that I define in clausular Where do sql server in the form below .. select * from tb_CentrosCusto cc where cc.Clasificacao like '1.4.1%' In other words, I’m just…
-
1
votes1
answer177
viewsGet Dropdown value when Textbox receives focus
What can I do to get the value that is selected in a DropDownList and move on to a TextBox only when the Textbox receive the focus (when the user clicks the field)? I had already put one…
-
1
votes1
answer93
viewsSelect item in Listbox with Binding?
I have a contact list: <ListBox Name="lstContatos"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal">…
-
1
votes1
answer74
viewsDisplay clickable link coming from the database
I want to display the Link that can be clickable, is appearing as text: I’m using the code below, but it still comes as text and I can’t click: @Html.Raw(HttpUtility.HtmlDecode(item.Facebook))…
-
1
votes1
answer408
viewsInsert to foreign SQL keys
I am learning a programming language and I set out to develop a budget program. My first obstacle is to add the values of the primary keys in the foreign keys of the respective tables. This code…
-
1
votes2
answers167
viewsHow to use Database Diagrams in Visual Studio 2015
I’m doing the exercises in the book: "Use the C#Head", and one of the exercises was asked to create a Database Diagrams. But you don’t have this option in Microsoft Visual Studio 2015. Book page: So…
-
1
votes0
answers531
viewsAndroid app works on emulator, but not on physical device
The entire project, including the back-end works perfectly when running on the emulator Android in the Visual Studio, but when I file APK on-mode release and run in my smartphone, only the front-end…
-
1
votes1
answer882
viewsHow to resolve error: The best overloaded method match for
Following the models of that question, when I pass the commands to write the form data to the database, before even copying Visual Studio, points out the following error: "The best overloaded method…
-
1
votes2
answers473
viewsSync items in comboboxes at runtime
I’ve been trying to figure out how to synchronize a combobox with another one for some time. I’m looking to synchronize comboboxes at runtime. When the user selects a category in the combobox,…
-
1
votes2
answers334
viewsCheck Consistency of a SQL Server backup in C#
How can I verify the integrity of the backup file of an SQL Server database in C#?? I used the following namespace and classes to generate the backup: Microsoft.SqlServer.Management.Smo {…
-
1
votes2
answers150
viewsWhat is the difference between public async System.Threading.Tasks.Task<Actionresult> Index() and public Actionresult Index()?
Follows the code: Example 1 : public async System.Threading.Tasks.Task<ActionResult> Index() { return View(); } Example 2: public ActionResult Index() { return View(); } Please explain the…
-
1
votes1
answer1137
viewsUpdate in Visual Studio database
could tell me where is the error in this small piece of code that I am creating for a budget program with a database with 4 tables (only the last cmd7 object is not accepted in the compilation):…
-
1
votes1
answer271
viewsWhat’s the difference between the two select?
Follows the code: Example: using (var ctx = new dbEntities()) { var resultado = ctx.Table.SqlQuery("Select * from Table WHERE id = 0 ").ToList<Table>(); } Other Example: private dbEntities db…
-
1
votes1
answer183
viewsUpdate problem with 1 field - EF
Follows the code: using (var db = new Entities()) { var t = new MinhaTabela { MeuCampo= 10 }; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); } Table definition: CREATE TABLE…
-
1
votes1
answer239
viewsInsert indented text in Textarea with Codemirror
I’m making an editor HTML in the browser, where the user can write his script in the Database, I recorded all lines of user code in a single string and recorded in the BD, but how do I bring back as…
-
1
votes1
answer1288
viewsPrint width on thermal printer, WPF and C#
Hello, I am making a program to print list of activities in thermal printers, in it I put this information within a table (created in print-only code, full width around 250, and font size like…
-
1
votes2
answers401
viewsHow to add a border to an image with C#
I would like to take an image and add a border at the top of the image (BMP). For what I researched I need load the image into an object create a rectangle object add the rectangle to the image but…
-
1
votes2
answers342
viewsFilter for the next 90 days ASP.NET MVC
need to make a filter with Line in an entity, this filter should bring all events for the next 90 days. Today’s example: 11/01/2017 until 11/04/2017 (90 days) _con.SiteContexto.AsNoTracking()…
-
1
votes1
answer433
viewsWrite data from a Datagridview
Hello I have this Datagridview below: I need to go through Datagrid, check which checkbox is marked and save the data (Quantity: Qty and Product Code: cod_product). I managed with Stack’s help to…
-
1
votes1
answer1171
viewsError: Access to Debug bin file
I’m watching some video lessons on Youtube about C# but there’s one in question that I can’t solve at first. The C# code I am using is exactly this below: using System; namespace IniciandoProjeto {…
-
1
votes1
answer195
viewshow to create index order desc through Dataannotations
I need to create an index in my model, but I need it to be decreasing Like I’m doing: [Index("Ix_PrecoConsultData", IsUnique = false, Order = 1)] public DateTime DataCadastro { get; set; } It…
-
1
votes0
answers192
viewsCreate xmpp server
I would like to know if there is still the possibility of writing a SERVER XMPP in C#. I have tried searching the internet, on many websites, and they only provide the CLIENT. I don’t know if the…
-
1
votes2
answers908
viewsPrinting windows Forms with direct reportviewer on printer
I have an application made in windows forms and reportviewer, my problem is in printing: I need to print right to the printer without having to open the check box to select the printer How to do…
-
1
votes1
answer264
viewsExchange of XML between service and client
I am studying WCF and all the initial material that I find it all comes down to very basic things, exposing methods that receive some parameters and return some value. I need to create a web service…
-
1
votes1
answer116
viewsUsing model Annotations for C#controller
I have this Annotation on my model [ZoneamentoDados(fim = 2, inicio = 1, tamanho = 2, obs = "Tipo Registro")] public String tipoRegistro { get; set; } [ZoneamentoDados(fim = 54, inicio = 54, tamanho…
-
1
votes1
answer1112
viewsHow to get date without Datetime time?
Within the date variable I have this: Here is the html code: <input type="text" class="form-control" readonly disabled value="@Model.Data"> Final result: What is the simplest way to get date ?…
-
1
votes2
answers734
viewsHow to hide and re-view taskbar in C#?
I want my application to have a button that hides and re-exports the Windows taskbar in C#, to block user access to it. Any suggestions?
-
1
votes1
answer6563
viewsUnable to load file or Assembly 'Entityframework, Version=5.0.0.0 or one of its dependencies
I wonder if anyone could help me with this mistake because I’m trying to enable the Migrations in a project and this error appears when giving the command enable-Migrations in the visual studio…
-
1
votes1
answer4652
viewsChange color of a given cell
I have a DataGridView which has 8 columns (days of the week) and x rows (hours of the day). I need to paint just one cell, getting like this: how could I do that? I already have the following…
-
1
votes0
answers196
viewsChange name of elements
I would like to clarify some doubts since I do not have much experience with Web-Services and, currently, I have been tasked to review and implement some changes in an already deployed system. For…
-
1
votes1
answer53
viewsHow do I validate how many images are inside a TIFF file?
I want to do a validation in C# for when to convert a TIFF image to JPEG I can know if all the images have been converted, because TIFF is a single file that sometimes brings several images inside…
-
1
votes0
answers352
viewsGenerate graph in Excel - C#
Hello, I would like to ask a question: I am exporting the data generated in a gridview to Excel, and at the same time I am generating a Graph in Excel itself from C#. I would like the chart size to…
-
1
votes2
answers181
viewsLinks in strip menu
You can link to a site in the Strip Menu of Windows Forms? I have the following code snippet in the click of my menu, but does not open the link. private void menuSobre_Click(object sender,…
-
1
votes1
answer69
viewsTimespan: count occurrences at a specific time
How could I assemble this method that counts the occurrences of a specific set of times in a period? public static int OcorrenciasDeHorarios( DateTime Inicio, DateTime Final, params string[]…
-
1
votes1
answer972
viewsSend list of JSON c#objects
Well, next, I’m trying to send a list of objects through JSON to a C#controller, where it contains an object Answer, and in that object, contains another call Field. However, in the controller, I…
-
1
votes1
answer70
viewsValue and ID at Dropdown Waterfall
Reference that can help you understand the code. Dropdown Cascata This part here I pass the values that will be added in the second Dropdown var classesList =…
-
1
votes0
answers46
viewsHow to create software in c# with local database?
I am creating a desktop application, however, it will not be for customer, but for user. I mean, people will download and install in their homes. The main question is: how do I get this system to…