Questions tagged as 'c#'

1
answer

Error registering user

When I try to create a second user, with ASP.NET MVC , I get an error:    Violation of PRIMARY KEY constraint 'PK_dbo.AspNetUsers'. Can not insert duplicate key in object 'dbo.AspNetUsers'. The duplicate key value is (00000000-0000-0000...
asked by 26.12.2016 / 20:16
1
answer

Block if you enter only one word in a TextBox

I work with C # - WPF and I have a field where the client can enter their full name. I would like to validate where it can not enter only the first name if it does not open a blocking message. That is, he would need to enter at least two names....
asked by 28.04.2015 / 14:47
1
answer

How to improve comparison and string concatenation C #

I have the following code: private static string MontarDescricaoOrgaoUoUe(RequisicaoFisica requisicao) { return !string.IsNullOrEmpty(MontarNomeOrgao(requisicao)) ? MontarNomeOrgao(requisicao) : !string....
asked by 29.09.2015 / 22:12
2
answers

C # Regular string expression and Guid validation

(1). I would like to validate a string, checking if it has only {a-z], [A-Z], [0-9], '-'} if(minhaString.ContemApenas({[a-z], [A-Z], [0-9], '-'}) == true) { // Minha string é válida! } (2). I need to also validate if such a string is a...
asked by 23.09.2015 / 21:38
2
answers

How to change the color of a row in the DataGrid in C #?

When I select a row in the DataGrid and then a button is clicked, the color of the selected row changes, I use Visual Studio 2013 and it's Wpf application.     
asked by 02.11.2014 / 15:54
3
answers

An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll

I'm trying to consume a service but gives the error:   An unhandled exception of type 'System.InvalidOperationException'   occurred in System.ServiceModel.dll And the message:    "Could not find the default endpoint element   which ref...
asked by 12.03.2015 / 02:08
1
answer

Unity - Error: Object reference not set to an instance of an object - Instantiate

I've done the Survival Shooter tutorial that can be found in the Unity asset store at link The game is working, but is giving this following error in the code. How do I resolve this? NullReferenceException: Object reference not set to an...
asked by 22.03.2015 / 03:26
1
answer

LINQ Group By with multiple fields in Key

How do I include IdCategoria in addition to the category name in the Console of the first FOREACH ? var lst = from p in BDProduto.produtos join c in BDProduto.categorias on p.IdCategor...
asked by 04.09.2015 / 18:32
2
answers

Check a character pattern for login

When using class Regex of C # I wanted the string nomeLogin Do not allow it to start with numbers or special characters. only allow "_" or "-" or "." as special characters. minimum of 2 characters being the first...
asked by 30.08.2015 / 21:39
2
answers

Do not display null value (01/01/0001) of a Datetime in a DataGridView

My DataGridView has some fields DateTime with value null (01/01/0001). How do I not display these values, leaving the field blank? Currently: HowIwouldlikeyoutostay: I'm using WindowsForm , C # and .Net Fra...
asked by 29.10.2014 / 11:04