Questions tagged as 'c#'

1
answer

Number of rows in DataGridView

I have a DataGridView and I need it to show me in a textbox the total number of rows I have in DataGridView. How can I do this. Below is my code private void ListaGrid() { string strSQL = @"SELECT CO...
asked by 10.05.2017 / 18:20
2
answers

MVC in C # how the statements work

I have the code below, and to call the session that stores the user data, only once do I want to put it in the controller declaration. Doubt The variable usuarioLogado is per request or it can happen that user X calls the controller...
asked by 30.03.2017 / 16:08
1
answer

How can I convert datetime to date string?

Follow the code: var fullEntries = dbContext.tbl_EntryPoint .Join( dbContext.tbl_Title, combinedEntry => combinedEntry.entry.TID, title => title.TID, (combinedEntry, title) => new {...
asked by 29.03.2017 / 02:05
1
answer

Create database without Migration in the Entity Framework Core

I am developing a study application in Entity Framework Core, and I saw that through code-first it is possible to generate the database using the add-migration command, but I would like to know if there is any way for the application to create t...
asked by 17.07.2017 / 23:19
1
answer

Error in my view

How do I play these messages in my view? Code that returns the messages: public ActionResult SaveInternalAuditRecord(InternalAuditRecord criticalAnalysisRecord, string idResponsibles, string idAuditors) { if (!ModelState.IsValid)...
asked by 19.07.2017 / 13:18
1
answer

IsGenericType, GetGenericTypeDefinition, and Nullable.GetUnderlyingType

In a snippet of code I was suggested to use these three members in order to check if the properties of an object are Nullable . p.PropertyType.IsGenericType && p.PropertyType.GetGenericTypeDefinition ( ) == typeof( Nullable<&g...
asked by 19.02.2017 / 00:22
2
answers

listbox with bank records

With this code I create an item in the listbox with the id number, I would like it to create an item for each id record it has in the database. Bank: Mysql Code: UWP C # using (_connection = new MySql.Data.MySqlClient.MySqlConnection("Databas...
asked by 13.03.2017 / 14:15
1
answer

In this case use switch or if?

I have an exercise to do that consists of the following: The user informs the salary, and depending on the value informed, it gains an increase according to the table. Example: From 1000 to 1500 he gains 10% From 1500 to 2000 he earns 5% 2000...
asked by 17.03.2017 / 05:15
2
answers

Class with method to change a parameter

I have a User class with private attributes like Nome , Endereco and Telefone . This class has a constructor method that receives parameters like nome , endereco and telefone . I'd like to use a construct...
asked by 28.02.2017 / 03:08
1
answer

When opening solution, folders with projects do not appear

I created a solution, based on the video of Eduardo Pires. I saved and went to do something else. Well, when reopening the solution, the folders with the projects do not appear, leaving only Solution indicating (0 project). How do I display my f...
asked by 27.02.2017 / 14:59