Questions tagged as '.net'

3
answers

What is the most recommended "try" or "if"

{ public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double SalarioBase = 0, Descontos = 0, Vantagens = 0; try { SalarioBase = Con...
asked by 15.05.2017 / 00:19
2
answers

Why does the unreachable error detected in C # occur? [closed]

public Boolean LogarUsuario(string Pnome, string Psenha) { using (OleDbConnection conexao = new OleDbConnection(Conexao.stringConn)) { conexao.Open(); cmd.CommandText = "SELECT * FROM Usuario WHERE...
asked by 12.01.2016 / 16:58
2
answers

How to restrict a set of a property?

I have the following property in my class: public char Naipe { get; set; } This property can only receive one of the following values: (char)9824 (Espada) (char)9827 (Paus) (char)9829 (Copas) (char)9830 (Ouro) These are Unicode deci...
asked by 16.12.2017 / 16:13
1
answer

SNS AWS in .NET C #

Has anyone implemented SNS in AWS with C #? I've implemented the code below in an attempt to send a topic created by the console, but I need to do everything for our ADM in .NET. Follow the code that I'm trying to upload by topic. It does...
asked by 26.04.2015 / 19:18
2
answers

Rename field in a lambda

In SQL I do this: select campo1 as teste from tabela And in a lambda ? How would I do it? I have this lambda with multiple tables and the ValuePayment field repeats several times. var qry = db.User.Join(db.Solicitation, user =>...
asked by 17.09.2018 / 19:23
1
answer

Is a URL important?

Most languages have methods to encode and decode a URL, such as C # System.Net.WebUtility.UrlEncode(string value) and System.Net.WebUtility.UrlDecode(string encodedValue) . I realized that when I use some language methods for Ur...
asked by 23.01.2018 / 06:51
1
answer

Difference between @Html.LabelFor and @Html.DisplayNameFor

I'm starting in ASP.NET MVC and doing a course where the teacher used to display data from a class different methods for displaying a given. It uses @Html.LabelFor and @Html.DisplayNameFor . From what I have read in other forums%...
asked by 12.01.2018 / 17:25
2
answers

How to get time difference between two DateTime variables in C #

I have two variables DateTime , which are DataCadastro and DataAtual(DateTime.Now) . I need to know if the time difference between these two dates is greater than or equal to 4 hours. Is there a method in the DateTime class th...
asked by 23.09.2015 / 15:28
4
answers

How do I use the F2 key to open another form?

I have the following code, but it enabled the ENTER (13) key to open the form, I would like to enable F2 , I already looked for ASCII tables everywhere and can not find the desired code. private void Form1_KeyPress(object sender, KeyPressEv...
asked by 23.09.2015 / 13:20
3
answers

Convert decimal to ushort

I need to convert a decimal value to ushort in my application: Is there a possibility? If yes, how to convert? I tried to use Convert.ToInt16(value) , but it did not work. Example in console: static void Main(st...
asked by 01.02.2018 / 15:13