Questions tagged as 'c#'

2
answers

How to truncate decimal to X decimal places? [closed]

I'm using the following code, but when I send ex: '10 .100 'to 2 houses it returns '10 .1', but should be '10 .10 ' public decimal TruncarDecimal(decimal value, int decimalPlaces) { decimal integralValue = Math.Truncate(value);...
asked by 19.09.2017 / 16:58
1
answer

Service not being called to update on the bank

I made a service and when I call on the URL , passing the proper parameters, does not work: Call URL : http://localhost:9078/api/atualiza/1000012120/teste My service: public class AtualizaController : ApiController { Auto...
asked by 14.09.2017 / 16:23
2
answers

My App does not load list of items

I have a App Xamarin.Forms that consumes two rest services. The first service, it consumes normally. But the second, I need to pass a parameter, it is not being consumed. I've tried it in many ways and it does not work. I know my c...
asked by 10.09.2017 / 23:27
1
answer

How to call the form inside another - Visual Studio

I have the parent form with a menuStrip. I already set it to isMdiContainer = True And I have another form that I call Services. In the Click event of the menuStrip > Service I put this: frmCadastroServico CadastroServico = new frmC...
asked by 20.09.2017 / 14:36
1
answer

C # MVC5 EF - How not to lose data after ModelState validation?

Below is my question if you can help. I use C # ASP.NET MVC 5 with Entity Framework. I have classes that represent below respectively a customer registry and an e-mail registry: public partial class Cliente { [Key] public int Client...
asked by 25.09.2017 / 17:19
1
answer

C # Calling an object from a string

I would like to know if there is a way to call an object from a string. Here is an example: public class Butao { public string _Name_; public float _Price_; public Butao(string name, float price) { _Name_ = name;...
asked by 06.07.2017 / 11:43
1
answer

How to dynamically grab the directory from the Content folder?

My question is the same as the title: how do I create a variable that points to the Content folder? I have a file there and I want to access it. I tried this way, but without success: StreamReader file = new StreamReader(@"~/Content/tb_ocup...
asked by 23.06.2017 / 00:28
1
answer

The percentage returns me zero in C #

When the results are printed, the percentage of men and women interviewed and people with incomes up to 500 reads equals zero. 'string nome; char sexo, estado_civil; int idade, cont = 0, cont_m = 0, cont_f = 0, cont_med...
asked by 27.06.2017 / 00:24
2
answers

Save / Recover files with PDF extension

To save files with PDF extension in the database do you need to do the conversion to base 64 ? Or would you have some other way to save this type and your recovery for viewing? The code I have below, does the image conversion to base 64 ,...
asked by 10.04.2018 / 20:14
2
answers

Javascript variable value assignment

I have the JS code below and the JSON return does not assign the value to the variable texto . I ran a test with alert(data.frase) and the message came normally. Does anyone know why var texto does not get the value of...
asked by 29.03.2017 / 17:32