Questions tagged as 'c#'

2
answers

Texbox that is updated in real time

This is simple but I'm not sure how to do it: The idea is to make a textbox inside a form in which if I enter a number this appears as '?' in the textbox. My idea is to do it with the KeyPress event: private void textBox1_KeyPress(objec...
asked by 27.08.2017 / 01:58
2
answers

Go through directory and compare its files with those of another directory C #

I have to take the files from a directory one by one and look in another directory for a file with the same name. Once they match, I have to call mostrarResultadoComparacionPropiedades() passing their paths as parameters. My code is this:...
asked by 05.10.2017 / 09:30
1
answer

Changes in the main process from a task

I have an application and I want to check through a Task if the user opens other applications and in that case minimize my application (but I can still use it for that purpose). The problem is that it throws an exception System.InvalidOper...
asked by 24.07.2017 / 12:29
2
answers

How do I replace the minimum values of a date with an empty string?

I have a program which calls a service when it executes, it gives me certain values and they are saved in a csv file. One of those values is a date which when it is empty shows me 1/1/0001 12:00:00 AM as a minimum value. What I want is that b...
asked by 27.10.2017 / 17:29
1
answer

File path problems when creating the project installer with ClickOnce

I have created an installer for my C # project with clickonce, but I have a problem with my file path, in this case with rdlc files (reportviewer), I declare it as follows: String rutadocumento = (Application.StartupPath).Replace("\bin...
asked by 08.08.2017 / 18:02
2
answers

C # MongoDb BsonDocument Add subdocument with a new ObjectId

Starting from: Class that adds a subdocument to a document public Boolean AggregateSubdocument(string nameCollection, string idDocument, string nameSubdocument, object subdomcument) { BsonDocument newSubdocument = BsonDocume...
asked by 27.10.2017 / 19:04
1
answer

Upload file to ftp server and backup

I have to upload a file to an ftp server (local host 127.0.0.1) but before I have to make a backup of that file (with a name different from the original) from where I upload it, this second part is what I can not do . I leave what I have until n...
asked by 31.10.2017 / 10:34
2
answers

How to allow a null date?

How can I assign a null date to a variable of the DateTime type? I have the following code: DateTime? FechaNula = new DateTime?(); deudaDto.FechaIngreso = deuda.FechaIngreso.HasValue ? deuda.FechaIngreso : FechaNula; but you mark me erro...
asked by 10.08.2017 / 19:34
1
answer

Add a node created to an existing node in XML document

Description. I must add a node to an XML document. The node that I have to add I build it perfectly, but I do not know how to insert it in the exact location I need inside the XML document. Code. With this code I build and insert the new...
asked by 17.01.2018 / 13:54
1
answer

How to get the number of days, hours and minutes elapsed from a date? in C #

I have tried to get the days, hours and minutes of a date from this: DateTime fecha_actual= "26-07-2017 18:45"; DateTime fecha_ingreso= "25-07-2017 16:45"; TimeSpan ts = fecha_actual - fecha_ingreso int differenceInDias = ts.Days; int differen...
asked by 27.07.2017 / 00:42