Questions tagged as '.net'

2
answers

Conversion specified is not valid in ExecuteScalar

The specified conversion error is not valid in the code: if (command.ExecuteScalar() == DBNull.Value) { resultados[j2][i2] = 0; } else { resultados[j2][i2] = (double)(decimal)command.ExecuteScalar(); /* <<---- */ } The query...
asked by 26.01.2016 / 20:40
1
answer

Get character index based on Width

I have the following method to calculate the width of a text: public float GetWidthOfString(string str, Font font, int bitmapWidth, int bitmapHeight) { Bitmap objBitmap = default(Bitmap); Graphics objGraphics = default(Graphics...
asked by 17.11.2015 / 14:38
1
answer

Create second column in DataTable

I have DataTable where with the code: DT.Column.Add("1ª", gettype(int32)) For I = 1 To 30 DT.Rows.Add(I) Next(I) This For enumerates column 1 from 1 to 30. 'DT is declared with a new DataTable , in...
asked by 11.11.2015 / 02:16
1
answer

Complex mapping Entity Framework

I'm creating a class structure that looks like the following: Department -Service One department provides various types of service. A specific service can only be provided by one department, not by many. A department can request service...
asked by 26.06.2015 / 00:26
1
answer

How to load DataTable into a DataGrid?

I have DataTable loaded with information in a WPF application. I would like to get this DataTable and load it into a DataGrid . How can I do this the easy way? DataGrid in XAML: <Grid> <Button Cont...
asked by 14.02.2015 / 23:23
1
answer

What is the difference in size and coordinate measurement in Forms from C #

In my project I work with the distance of elements and their size. But on a 600-by-600 screen, when you insert a 100-percent object, it appears to be much smaller than 1/6 of the screen, and when checking the distance from the object's center po...
asked by 05.09.2014 / 15:08
1
answer

ASP.Net MVC application does not connect to the database

I'm developing a solution in object-oriented programming class for web. Let's create a stock control system. One of the first "screens" of access, is the login, only that at the moment, my whole 'application' already goes down. In the first...
asked by 11.09.2014 / 00:50
1
answer

How to export an HTML / C # (Razor) page to PDF?

I have some simple tables and need to export them to PDF. I found the itextsharp library, but in the compressed file there are many folders and files and I do not know how to add the reference in my application. I would like help exporting, e...
asked by 26.03.2014 / 22:20
1
answer

Bank query for a List in C # WPF

I need to make a query in the database, I made this code for connection, but I do not know how to proceed to put this information in a list<String> SqlConnection conexao = new SqlConnection(_stringConexao); SqlCommand comando = ne...
asked by 22.12.2014 / 11:57
2
answers

Enable / Disable Button according to Checkbox value in a DataGridView

A form in an application Windows Forms with C# displays a DataGridView with Checkbox . When one of the Checkbox is checked I want to enable a certain button. If no Checkbox is checked, I want to disable i...
asked by 04.01.2015 / 22:07