Most voted ".net" questions
The Microsoft . NET is a set of libraries and functions that are part of the Basic Class Library (BCL), such as user interface functions, data access, connectivity, cryptography, web development, mathematical algorithms, and network communication.
Learn more…2,689 questions
Sort by count of
-
3
votes1
answer4824
viewsUndefined object reference for an object instance
I created a DLL with the option "Register COM Interop" in C# where some Webservices from different prefectures are consumed. I use this DLL in a Windows Form C# test application where no error…
-
3
votes6
answers6055
viewsPart of the Label in Bold?
How to place a part of the string of a Label in the Windows Form in bold via code in c#. Someone knows something via code for that?
-
3
votes5
answers1583
viewsHow to get the number of weeks in a date range in C#?
I would like to know how to know the number of weeks in a given date range in C#.
-
3
votes2
answers650
viewsCreating custom Annotations in ASP.NET
I own a Controller in my project Asp.net (Web Service) I need to do a token check for each method request. One solution I found is to create a static method and place a call at each start of each…
-
3
votes2
answers181
viewsConfusing encapsulation in c#
I was creating a model that in his construtor i defined the attribute Nome. however this attribute will only have the get, as different from java c# has the resource for getters and setters I…
-
3
votes1
answer9340
viewsCheck if the given value is numerical and has 9 characters
How can I verify if a value is numerical, and only numerical (without occurrence of points, strokes, etc.), regardless of the amount of characters that the number contains, besides having exactly 9…
-
3
votes2
answers985
viewsHow to export an HTML/C#(Razor) page to PDF?
I have some simple tables and need to export them to PDF. I found the library itextsharp, but in the compressed file there are many folders and files and do not know how to add the reference in my…
-
3
votes2
answers2290
viewsCan I use the same WPF view for Desktop and Web?
Dear ones, I have never programmed with WPF but soon I will have the opportunity and already thinking about the future, which is now, in which desktop applications will be/are being migrated to the…
-
3
votes2
answers2189
viewsConvert Date dd/mm/yyyy to ISO 8601 format (yyyy-mm-dd)
I have a field called maskedTextBox2 in C# Windows Form, which contains a date mask in the format dd/mm/aaaa. How can I convert this string format aaaa-mm-dd to save to Mysql database, which uses…
-
3
votes2
answers239
views -
3
votes4
answers3125
viewsDealing with collisions in Dictionary C#
I need to map a string array to a dictionary so that I can later test whether an informed string is valid by checking if it is part of the dict, additionally would like to recover some other…
-
3
votes1
answer261
viewsXML returning incorrect values
I’m trying to do a show on c# to test the codes needed to run a xml, read your data and enter it in a list. But for this, I preferred to use a MessageBox to do the debug first. Man xml is a RSS Feed…
-
3
votes1
answer1354
views -
3
votes2
answers2764
viewsIF condition inside _Layout.cshtml in MVC
I have two _Shared.cshtml (MVC masterpage type, do not know the name) and both are virtually equal, only the menu left is different. I would like to do only 1 and according to the querystring I will…
-
3
votes2
answers1406
viewsChange registry key values Windows
It is possible to build an application which it searches for a key in the Windows registry with an exact name and when finding change its value by a user-defined value? If possible what is the best…
-
3
votes2
answers1100
viewsLDAP and AD - Error adding user to group with C#
I am trying to add a user to the group, but I am returned the following error: Message: The server is reluctant to process the request. Errorcode: -2147016651 Extendederror: 1359…
-
3
votes1
answer159
views(ASP NET MVC4 or 5) How to pass a custom name to Xmlhttprequest?
Guys the question is this, I have a <input type="file" id="fileupload"/> and a field <input type="text id="Nome"/>. To pass it to my controller, I do the following: var data =…
-
3
votes1
answer2694
viewsConnection to the database with App.config
How to establish a connection to the Northwind database using App.config and ADO.NET?
-
3
votes3
answers3136
viewsGenerate 32 character MD5 password with Cryptsharp
I am using the Cryptsharp library to generate password in MD5. I had read that MD5 generates string with hexadecimals of 32 characters but is generating 34 and with several types of characters. It’s…
-
3
votes2
answers133
viewsLoop Loop C# Asp components
You’d have to do a loop loop in this case? PaperBLL paperBLL = new PaperBLL(); List<PaperEO> papers = paperBLL.SelectPapers(); HyperLink1.ImageUrl =…
-
3
votes1
answer92
viewsException mapping . NET for HTTP status codes
Situation I’m working on one Httpmodule who is responsible for monitoring usage patterns and intercepting and managing untreated exceptions in ASP.NET applications via events BeginRequest,…
-
3
votes1
answer195
viewsWhat is the size and coordinate measurement difference in C#Forms
In my project I work with the distance of elements and their size. But on a screen, 600 by 600, when inserting an object, 100 by 100, it appears to be much smaller than 1/6 of the screen, and when…
-
3
votes2
answers907
viewsHow to count . xls / . xlsx files in folder with C#?
I have a Folderbrowserdialog and when I select the folder it shows the amount files (all, no filter). How do I do this length only with Excel files (.xls, . xlsx). Follow the code below:…
-
3
votes1
answer141
viewsASP.Net MVC application does not connect to the bank
I’m developing a Solution in the object-oriented programming class for the web. Let’s create a stock control system. One of the first "screens" of access, is the login, only at this moment, my…
-
3
votes3
answers936
viewsHTML Helpers in ASP.NET MVC 4
I saw some HTML Helpers like this: @Html.LabelFor(x => x) and @Html.LabelFor(model => model.Propriedade), however, I do not understand this parameter that I must pass, x => x, what is this?…
-
3
votes1
answer783
viewsAccess Denied when saving image to an application
I made a Silverlight app that captures image using web cam. The application works perfectly however when I save the captured image generates the following error: File Operation not permitted. Access…
-
3
votes2
answers83
views -
3
votes1
answer1312
viewsDefinition of non-generic method?
In public partial class frmAltInfo : Form Error occurs: Extension method must be defined in a non-generic Static class I don’t understand what it can be or how to fix it. Here was the mistake:…
-
3
votes1
answer1746
viewsHow to align a string in a 42-character space
I am generating a text file and have to align the company name to the center, but the company name will vary for each customer, the default amount of characters are 42. texto="lb_NomeEmpresa.text";…
-
3
votes2
answers103
viewsHow to capture Assembly from classes that inherit from a single class
I have numerous classes. All inherit from a single class public abstract class ClasseBase { public int Id {get;set;} } and other classes: public class Teste1 : ClasseBase{ } public class Teste2 :…
-
3
votes1
answer935
viewsDatabase query for a C#List
I need to make a query at the bank, I made this code for connection, but I do not know how to proceed to put this information in a list<String> SqlConnection conexao = new…
-
3
votes2
answers593
viewsHow to pass filenames to a Datagridview using Folderbrowserdialog?
How do I pass the name of the files that were found inside the selected folder? So far I’ve only managed to get him to pick up the file’s path and move on to the DataGridView and now I want to make…
-
3
votes3
answers205
viewsProblems with logic (&& or ||)
I found strange the code that is in my system: if (cmbCdTipoProcesso.SelectedValue != "3" && cmbCdTipoProcesso.SelectedValue != "4") {....} Apparently the code is weird, 'cause I’ll never…
-
3
votes2
answers2851
viewsEnable/Disable Button according to Checkbox value in a Datagridview
A form in an application Windows Forms with C# displays a DataGridView with Checkbox. When one of Checkbox is marked I want to enable a certain button. If any Checkbox is marked I want to disable.…
-
3
votes2
answers398
viewsCreate modules using Unity (Ioc)
In an application using a multi-tier (n-layer) architecture, we have the infrastructure layer where we use an Ioc container to record the required dependencies. In a prototype I’m working on, I’m…
-
3
votes3
answers2241
viewsHow to create nonexistent columns in a Datatable?
Here is my query: select u.nome as analista, s.descricao as situacao, count(*) as qtd from tb_projeto p inner join tb_usuario u on u.id_usuario = p.id_usuario inner join tb_situacao s on…
-
3
votes2
answers2309
views'Data Access Layer' is the same as 'Data Access Object'?
I’ve always used DAO (Data Access Object) in Java Web and now I’m leaving for the platform. NET (C#), I saw that there is the DAL layer (Data Access Layer). I was confused, the DAL would be the same…
-
3
votes1
answer1363
viewsHow to load Datatable on a Datagrid?
I have a DataTable loaded with information in a WPF application. I’d like to take that DataTable and carry it on a DataGrid. How can I do this the easy way ? DataGrid in the XAML: <Grid>…
-
3
votes4
answers1209
viewsButton with pause function
I have a little app that inserts images into the database. There are many images and sometimes I need to stop the execution for a period and continue at another time not to disturb the client’s…
-
3
votes1
answer65
viewsWhat is System.Void type
Until then I believed that void was just a keyword to indicate a no return method, but then I found System.Void on MSDN. This changes something?
-
3
votes2
answers607
viewsForeach duplicating the data
I possess 2 foreachs, to search for dates on ViewBags, where I return both in a select. But for each item of the first foreach, it makes a complete loop in the second, thus doubling the values, for…
-
3
votes0
answers421
viewsError importing Nfse Service from Aracaju
I’m trying to add this service in VS 2013: https://www3.webiss.com.br/aracajuse_wsnfse/NfseServices.svc But it is not possible to add this URL as a service. Normally the URL’s I add do not have the…
-
3
votes1
answer485
viewsUpload system with rotate image automatically as in windows 8.1 or facebook
Today when viewing an image in windows 8.1 even if the image is lying down it automatically understands and shows correctly, in windows 7 appears the picture lying down. When sending this image to…
-
3
votes3
answers162
viewsRelationship Have-one in C#?
I tried to do a have-one relationship in C# and I’m not getting it and I don’t even know if it’s recommended to do. Follow my error code: System.Nullreferenceexception Undefined object reference for…
-
3
votes1
answer1091
viewsGeneric object reference error
System.Nullreferenceexception: Undefined object reference for an instance of an object. This error is giving in the following code snippet: Arquivo arquivo = new Arquivo(); ArquivoVersao versao =…
-
3
votes1
answer408
viewsVar inside the FOR when starting at 0(zero) Count should be Count-1?
I picked up a system at the company where I work for another colleague. I note that all FOR’s are like this: for(int i = 0; i < lista.count; i++) { //meu código } I learned that when a variable…
-
3
votes1
answer634
viewsHow to convert latitude/longitude to Double in C#
I have a problem because I have a variable of the type string and I need to convert to the guy double without losing the "dot". Example: string latitude = "-8.709006" when converting is equal to:…
-
3
votes3
answers4129
viewsDirectory problems
I am trying to read a file . html but I cannot get the path of this file. I have already used Environment.GetCurrentDirectory and Directory.GetCurrentDirectory but did not succeed. Below follows…
-
3
votes3
answers707
viewsSum table values
I have a table where I return the amounts paid per taxpayer monthly. But I need to create a subtotal field, adding up the values of each month. Very similar to the Fibonacci sequence. The problem is…
-
3
votes2
answers2092
viewsFill all fields of an Object iteratively
I have a Class public class Objeto { public int _numero { get; set; } public DateTime _data { get; set; } public string _palavra { get; set; } public decimal _decimal { get; set; } } Is it possible…