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
-
4
votes1
answer957
viewsHow to save text in XML or txt or HTML file?
I am developing a program in C# and would like to know how to save the text of a RichTextBox format .xml or .html or .txt.
-
4
votes1
answer600
viewsHow do I know if a client is accessing the server over the local network or the internet?
How do I identify if the client who is accessing my application, whether it is within the company (local network) or outside (internet)?
-
4
votes4
answers2257
viewsCheck if user is logged in
I would like to know how to block access when the user is not logged in to the system, however, the only page that can be accessed is the Login and when he tries to access any other page redirect to…
-
4
votes1
answer4336
viewsException when it will generate bank bill with Boleto.Net
I have a system that generates Santander billets using a specific DLL that was downloaded from the internet. The name is "Boleto.net". I need to create a Bradesco ticket. I changed where I passed…
-
4
votes1
answer310
viewsHow to go through all the controls of a WPF window?
Is there any way I can go through all the controls of a window and disable them? For example, do a foreach that disables one by one of the controls. Something like below, only for WPF, and not…
-
4
votes1
answer156
viewsHow to get Timezone?
I have the following code: var minhaData = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, meuTimeZone); Case meuTimeZone = "E. South America Standard Time"; then the value returned to…
-
4
votes4
answers5878
viewsConvert String to Decimal
And I’m having trouble properly converting this string in decimal. decimal.Parse(txtValor.Text)=meuVen.Valor; When I put the conversion in front, it shows error after the =. I don’t know how to…
-
4
votes1
answer151
views.Net Reflector compilation errors
I’m studying C# and I’m trying to learn a little reverse engineering. I’m making the following mistake: private void button1_Click(object sender, EventArgs e) { this.Result = true; this.ConfigName =…
-
4
votes3
answers4420
viewsError when signing a SHA256 Hash using Digital Certificate
Is returning error from Invalid algorithm Specified, when it will be signed, how to proceed? Dim data = Encoding.UTF8.GetBytes(Me.txtCNPJEmpresa.Text + Me.txtCNPJSoftwareHouse.Text) Dim csp As…
-
4
votes1
answer785
viewsError when trying to connect to SQL Server from webservice on IIS 7.5
I am getting some errors when trying to perform a query in SQL Server from a Webservice hosted on an IIS 7.5 server. My connectionString on the web.config: <connectionStrings> <remove…
-
4
votes3
answers3309
viewsGenerate PDF with Asp.Net MVC
Hello, in my application the reports are generated in Html, I would like to know a way to generate these Html reports in PDF.
-
4
votes1
answer269
views -
4
votes3
answers125
viewsSearch List(Of String) - Case insensitive
How to look for a String in a List(Of String) without considering the case? I’m using . net 2.0. Contains does not allow passing any additional parameter. I tried to use Find but it didn’t work…
-
4
votes2
answers1182
viewsHow to remove mask from the field before calling the controller with Asp net MVC
In my registration form I have a CNPJ field with the mask set via jquery $("#cnpj").mask("99.999.999/9999-99"); however the value is coming in my formatted controller, in my database this field is…
-
4
votes1
answer199
viewsConvert string to specific format in date
I have a string "sex, nov 6" and need to convert to DateTime. I’m doing it this way: DateTime datetime = DateTime.Parse(gridT.Columns[e.ColumnIndex].HeaderText.ToString()); But it’s not working. How…
-
4
votes2
answers995
views -
4
votes1
answer8783
viewsHow to set Grid View column width?
I would like to know how to define the width of the DataGridView manually. My first column has to have a fixed value and the other columns must "fill" the grid so that they are the same size.…
-
4
votes2
answers119
viewsBest way to give Binding on objects from 1 to N - Asp.net MVC
I would like to know how best to give the Binding of data in the object FuncaoGrupo of my Controller. Each item in the list Funcoes will generate 4 Checkbox in View. I have the following class:…
-
4
votes2
answers4252
viewsError: Undefined object reference for an object instance, how to resolve?
I have the method ChamadaEfetuada(MAluno) : bool checking whether the call was made to a particular student, this method is used in another method ChamadaEfetuada() : bool that instead of checking…
-
4
votes1
answer1358
viewsCatch Penultimate record of a table with Entity Framework
How do I get the penultimate record from an Entity Framework table
-
4
votes1
answer108
viewsError in . First(), as there is no selected result
In my controller of Login I use the following code to select the user if it exists, but whenever the user type the incorrect name or password, it gives an error, because it does not find the result…
-
4
votes2
answers4976
viewsRemove the time part of a date in c#
This is not working: DateTime? _data = calDataExclusao.Date; string nova_data = _data.ToString("dd/mm/yyyy"); The mistake is: No Overload for method 'Tostring' takes 1 Arguments How I remove the…
-
4
votes3
answers155
viewsWhy should I use the typeof keyword to assign a data source to a Bindingsource.Datasource?
For example: BindingSource bs = new BindingSource(); bs.DataSource = typeof(object); Why should I use typeof(object) instead of just object or even "object"? Edit: As other people have asked,…
-
4
votes2
answers55
viewsGet information stored in an "attribute"
In the ORM I use, classes are mapped using Attributes. I need to recover the value stored in them. Ex.: [Table("CADASTRO_CLIENTE")] public class Cliente { [Property("Id")] public int Id { get; set;…
-
4
votes2
answers1276
viewsHow to lock an executable file and prevent it from opening on Windows?
I would like to create a particular program where I can block programs from running on Windows, I know that Windows itself provides something basic about this, but I wanted to create my program,…
-
4
votes2
answers989
viewsHow to install Sqlite to be part of a C#project?
I am creating a desktop application in C# of registration that will use database. Which database to use? I was advised to use the Sqlite, but I’m not quite sure how to use it. Which version of…
-
4
votes2
answers1770
viewsReferencing folders created in the project
After I go to Project > Add > New Folder, rename the folder and put classes inside it I can no longer reference it in another file, for example if I would use in one controller, I would use as…
-
4
votes2
answers960
viewsWhat is the purpose of the 'Let' statement in a LINQ query?
I have the following LINQ query: var source = from em in query select new { Id = em.UniqueID, Data = em.Data == DateTime.MinValue ? "" : em.Data.Value.ToString("dd/MM/yy HH:mm") }; The estate Data…
-
4
votes1
answer715
viewsFile comparison
I need to compare files from different directories and show the differences. But I don’t want to list the name of the files, I just want you to make a comparison of the directories and show the…
-
4
votes4
answers156
viewsHow to avoid repetition in LINQ queries?
I have the following query LINQ which is in a method that returns all products: var query = from p in Produtos select new Produto { ProdutoId = p.ProdutoId, Descricao = p.Descricao, Preco = p.Preco,…
-
4
votes2
answers403
viewsHow to filter in LINQ for every X months?
Hello, I would like to know the best way to filter a list of objects using LINQ in C#, I have a list of objects called Measuring, each measurement has a Data property, which is the date that was…
-
4
votes1
answer91
viewsHow to create an endless process?
Simple question, how do I make my application process to be "unstoppable" by the system? I want when a user tries to close the application to appear the message "Access denied", and when it forces…
-
4
votes1
answer986
viewsHow to create runtime formulas in C#?
There are many advantages when things change for the better, so were the changes from the Clipper to Delphi and C#, actually only in the visual part. There was in the Clipper a fantastic feature…
-
4
votes1
answer1911
views#if DEBUG always runs, even in release mode
I’m trying to use the directive #if for a given method to be executed only after publication (in release mode). The code is something like #if !DEBUG AlgumMetodo(); #endif I’ve also tried to add the…
-
4
votes4
answers832
viewsCreate layout for PHP and . NET applications
Work in a public body and we have numerous web applications in PHP and .NET. I’m working on a standard layout so we can maintain visual identity across all systems. Is there any way…
-
4
votes2
answers98
viewsFaster way to add an item to a list, using a structure
Structure turma Public id_turma As Integer Public nome_turma As String End Structure Structure Disciplina Public id_disciplinas As Integer Public nome_disciplina As Integer End Structure Public…
-
4
votes1
answer308
viewsHow to cast exception in SQL and treat in C#
I’m creating procedures in an SQL Server database. To clear a brand, I first check if the brand is already tied to a product before deleting. CREATE PROCEDURE SP_Delete_MarcasProdutos @Id int AS…
-
4
votes2
answers3900
viewsRPS Batch Digital Signature (NFS-e) error: Poorly formed reference element
We have a system that sends lots of RPS to prefectures of various cities in Brazil. The system was sending lots of RPS smoothly but last Friday (11/03/2016) stopped working and presented the…
-
4
votes1
answer386
viewsRecover Volume Name of Netmapped Disk Drive
I’m using DriveInfo.GetDrivers() to take the names of the disk drives present on the machine and list them on a TreeView. I made the code below that works, however it does not appear the names of…
-
4
votes2
answers161
viewsProtecting data in memory
I read several articles on cryptography etc... The cryptography reported by posts was a success in my program, however some data remains in memory being vulnerable to Assembly readers in real time.…
-
4
votes0
answers853
viewsPost Office - PLP XML
In the Postal web service there is a process of sending plp (pre-mailing list), which contains information of the postal objects. I’m sending this plp by the method fechaPlpVariosServicos. But when…
-
4
votes1
answer61
viewsPartial for separation of events and methods
I saw in a system a separation of methods in a partial and the events in another in UserControl and Window as the example below: "Pessoa.xaml.cs" public partial class Pessoa: UserControl {…
-
4
votes2
answers2098
viewsDisplay decimals (Currency) is rounding
I have an application where the price should go in format int decimal-free. int Valor = (int)(produto.Valor * 100); //o produto.Valor é um decimal The problem is when I want to display this value in…
-
4
votes1
answer1339
viewsHow to get attribute of a generic type object?
I’m having difficulties p/ retrieve an object to get a specific attribute. I want to overwrite the method Equals in my class, to compare whether the title of objects are identical. In this case, it…
-
4
votes1
answer344
viewsDifferences in constructors using property vs field (field)
namespace WMB.CieloB { internal class FuncoesCielo { internal FuncoesCielo(int iDC, Boleto boleto) { IDCliente = iDC; this.boleto = boleto; } public int IDCliente { get; set; } internal Transaction…
-
4
votes1
answer979
viewsFunction that converts hexadecimal to binary
Is there any function equivalent to bin2hex() from PHP to C#? I need to convert a hexadecimal to binary. I tried to use the TryParse but it hasn’t worked out.
-
4
votes2
answers87
viewsHow to draw items from a Listbox using quicksort
I am carrying out a project for the University that consists in carrying out a software that makes the 'Sort' of a listbox using quicksort , Blubblesort etc... In VB.NET I made an array to generate…
-
4
votes1
answer1210
viewsHow to decrease byte array size that represents an image
I have an array of bytes in Base64 that is in a string in C#. It represents an image. The size of the string is between 50 and 80 thousand characters. I wanted to know if it has how to decrease this…
-
4
votes2
answers569
viewsReturn Datareader to bool field
I need to return a field that is of the type bool: public List<TB_USUARIO> ListarTodos() { var strQuery = "select * from tb_usuario"; using (contexto = new Contexto()) { var retornoDataReader…
-
4
votes3
answers113
viewsHow to implement custom features in a model on . NET?
I needed to implement some features in the model users but as you can see early on this class is automatically generated by Entity, so whenever I upgrade or recreate the model the custom…