Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
1
votes1
answer95
viewsHow can I intercept click on link within Webview?
In my Android app, I have a webview that opens several different websites. Everything works in the compliant, but when there is a link on the page, and the user clicks on this link, the browser…
-
1
votes1
answer125
viewsError while compiling project
I am receiving the following message to perform the build in the project. Error A namespace cannot directly contain Members such as Fields or methods Files : Model1.Cs Model1.Context.Cs Line 1…
-
1
votes1
answer653
viewsMethod within method or class within class
Created the methods Above(), Below(), Highest(), Lowest(), Evens(), Odds(), Matching(), Repeating(), Unique()... I need to create a structure/implement these methods inside each other, as if they…
-
1
votes1
answer87
viewsData Annotation - error ratio 1:1
I’m trying to make a 1-to-1 relationship. Apparently it would be something simple but my system is getting lost in this relationship; It doesn’t make a mistake, but the relationship is wrong: Model:…
-
1
votes1
answer1757
viewsException Error "' ', hexadecimal value 0x1F, is an invalid Character. Line 1, position 1"
I have an app made on C# to show the menu of my university’s university restaurant, which picks up the information through a XML. The app allows individual consultation of each meal (breakfast,…
-
1
votes4
answers708
viewsConversion of interface list into object list: (List<Interface> in List<Object>)
I need to convert a IList<Interface> in a List<Objeto>. Take the example: public interface IObjetosBase { IList<IObjetosBase> get(); } public class ObjetosBase : IObjetosBase {…
-
1
votes3
answers1640
viewsDatetime function C#
I came across an exercise in which to convert the date of AM/PM format to military format (24h). So, suppose the user type 07:05:45PM, the program should return 19:05:45. I don’t really like looking…
-
1
votes0
answers62
viewsWhat is the difference between the forms of LINQ research?
What’s the difference between: var query = from s in db.DetailsRaWeb where s.cod_cli.Equals(Cod_Cli) && s.tag.Equals(TAG) select s; and this: query = query.Where(s =>…
-
1
votes1
answer113
viewsRelationship in table with Include does not work
I can’t get my father table to include the dependent: var medicos = TabelaMedico.Include(m => m.Especialidade).ToList(); Displays the following error message: CS1660: Cannot Convert lambda…
-
1
votes1
answer2775
viewsSign XML Nfse
I need to sign the following XML: <?xml version="1.0" encoding="utf-8"?> <EnviarLoteRpsEnvio xmlns="http://www.abrasf.org.br/nfse.xsd"> <LoteRps Id="Id1" versao="Token1">…
-
1
votes1
answer405
viewsThread occupying a lot of memory
Come on . I’m loading Buttons into a panel through the Backgroundworker. That is, within this Background I execute a query in the bank through the EF and fill the panel with the Buttons that contain…
-
1
votes2
answers799
viewsDirect image upload to BD Mysql using C#
I am creating a WEB application using C# and a Mysql BD. I need to upload an image to the bank and then retrieve it. I’m a beginner in this world, but what I have so far: I have a field fupCPF which…
-
1
votes1
answer928
viewsHow to treat a decimal field with no homes after comma in a jquery mvc c#mask
I have a model with the following definition: [Display(Name = "Quantidade / Volume:")] public Int32 RoQuantidade { set; get; } In my View to fill the data when empty, that is, that have not yet been…
-
1
votes2
answers1072
viewsOpen Form in tabcontrol specifies
Command to open a form in a specific tabcontrol. Example: in a form I have a tabcontrol with two tabs: register and consult. Then I wanted to (with a button) open this form right in the tab consult.…
-
1
votes1
answer1481
viewsHow to compile/buildar a DLL?
I made a program in C# in Visual Studio 2017, but by default, when I compile the code, it creates a file .exe, but I would like the code to compile a file .dll. How can I do that? Example: I created…
-
1
votes0
answers46
viewsCreation and editing of dynamic objects
Greetings guys. I have a "problem" and I wanted some ideas of how I can solve it. My goal is to make a selection "animation" on several Buttons, so that when one of the Buttons is clicked, a Panel…
c#asked 8 years, 7 months ago Daniel Freitas 11 -
1
votes1
answer98
viewsAdd a <div> to each <li> - Htmlgenericcontrol tag
I am reading an RSS XML and adding each news to a tag <li> I need every tag <li> stay within a tag <div>, how can I do this through Htmlgenericcontrol? That way <div>…
-
1
votes1
answer962
viewsPassing Javascript Parameters to [Webmethod] C#
I would like to know how to pass parameters of a Javascript call to an ASMX Webservice Method without having to define a name for the parameters. Example: $scope.testar = () =>{ filtros ={ id:1,…
-
1
votes2
answers466
viewsHow to delete div by class name using Webbrowser?
Considering this code: <div class="panel panel-default"> <div class="panel-heading"> <p>Informações Adicionais</p> </div> <div class="panel-body"> <ul…
-
1
votes0
answers60
viewsDisplay class relationship in Datagridview?
I’m trying to display a class relationship in Datagridview but I’m not getting it. I have 3 classes Produto and Unidade and ItemVenda, the class Unidade refer to the unit of the product if it is…
-
1
votes2
answers426
viewsHttpclient how to make a request every 1 second
Can I make a request via Httpclient every 1 second? The server I send requests blocks the request if it is one behind the other with an answer: "Requestblocked" What I wanted was this: I had two…
c#asked 7 years, 4 months ago matheus Lopes 48 -
1
votes0
answers57
viewsSimplebrowser - Click a button on a web page
Good morning, I am trying to upload a file online and upload this uploaded file after clicking the button. All this using Simplebrowser. However, in no way I can click this button, I believe that…
-
1
votes0
answers269
viewsINNER JOIN FETCH Nhibernate is not filling properties
I have the following query in HQL: select photoRating from PhotoRating as photoRating inner join fetch photoRating.FormularioRespostaDoUsuario as form inner join fetch form.Trecho as section And…
-
1
votes1
answer487
viewsQuestions about Script Coroutine c#
I made a script along with the coroutine, but it kind of doesn’t work without error My real intention is to make the button have a delay of up to 10 seconds before transitioning to another song…
-
1
votes0
answers319
viewsDocumentation in C#
I would like to document an api for C#, in the style javadoc. Is there any way to memorize/comment the code so that documentation of the types and their members is generated automatically? C# gives…
-
1
votes1
answer396
viewsHow can I put these random questions?
using UnityEngine; using UnityEngine.UI; using System.Collections; public class responder : MonoBehaviour { private int idTema; public Text pergunta; public Text RespostaA; public Text RespostaB;…
-
1
votes1
answer61
viewsThe show() method in my wpf does not work
I made a tiny desktop application using wpf. I have a very simple login screen and this screen should call the main screen. I did so: Menu menu = new Menu(); menu.Show(); You are making a mistake in…
-
1
votes1
answer1591
viewsHow to show "loading" screen with modal bootstrap in any c#server process
I need my pages to show the whole server process a screen with a type of Carrying using the modal bootstrap I created below. My problem is to be able to show this in all processes. Is there any way…
-
1
votes1
answer41
viewsIs it possible to instantiate a database connection manually using the Entity Framework?
I would like to manage my connections manually so that users can inform the server address, but Entity creates the connection string directly in the config file, the only way would be to change that…
-
1
votes2
answers272
viewsUsing Unity 3D tags?
I cannot identify my prefabs with the tags I have set, I have already added the tags to the prefabs as you can see below: and my condigo: public void Checks(){ for (int y = 0; y < gridHeight;…
-
1
votes1
answer199
viewsMake a textbox visible by selecting a radio button
With the code below I can do this procedure but I have to click the button. It seems that it needs a refresh to work <asp:RadioButton ID="RadioButton1" runat="server" GroupName="pesquisa" />…
-
1
votes2
answers128
viewsVisual Studio Installer Projects with Postgresql
I am starting a Windows Form C#project, a commercial application that the user downloads, installs and uses, without complications. It is possible to configure Visual Studio Installer Projects to…
-
1
votes3
answers62
viewsMemory and processing - Variables and verification
Is there a big difference for memory and processing in how to perform the verification in these two examples? If yes, why and how they both behave when executing the codes. Method 1: var exam =…
-
1
votes0
answers82
viewsWays to inform address
Good afternoon people, I have a question not very technical, but ways to get information. Here at the company we have a form for our users to inform service addresses. This form has the automatic…
-
1
votes1
answer182
viewsFormsauthentication causes an infinite redirect error - ASP.NET C#
Good afternoon, I am developing an ASP.NET application with C# that requires login, works and is being used this way: protected void Page_Load(object sender, EventArgs e) { SqlConnection conn = new…
c# asp.net visual-studio-2015 sql-server-2012 forms-authenticationasked 8 years, 7 months ago Kawaii 151 -
1
votes1
answer429
viewsMatrix Printer Printing with WPF C#
How do I print my tickets to a matrix printer (LX300) from routines made in WPF C#? Do you have anything specific for this? A drive or plugin?
-
1
votes1
answer81
viewsHow to assign a style to all objects at once in WPF
It is possible to create a style in WPF where will be using for all components of the same type, so it is not necessary to call the Style for the component? My idea is to create a style as for…
-
1
votes1
answer47
viewsIs it possible to do assignment with shorter object initializer?
Is there any way the third instance works with subtraction attribute? private void btnGrasieli_Click(object sender, EventArgs e) { /*Isto funciona Bbanco = new Banco(); Bbanco.Valor = Bbanco.Valor -…
c#asked 7 years, 3 months ago rock.ownar 355 -
1
votes1
answer616
viewsWhat is the difference between Getkeystate() and Getasynckeystate()?
I’ve always used the GetKeyState() to know if the user is pressing a key, but I see that many people use more the GetAsyncKeyState(). With that came to me the following doubts: What is the…
-
1
votes1
answer84
viewsChange Tabindex
How do I get back the TabIndex of a Form for a given position? I tried to use the this.ActiveControl.TabIndex = 0;, but it didn’t work out.…
-
1
votes1
answer341
viewsHow to create events dynamically? C#
I am doing a project of a statistical calculator, in it I made a method that creates tabs in a tab control and inside them a datagridview to display the different tables generated by the program. I…
-
1
votes1
answer113
viewsLinq Return all records when ID is NULL
Consultation: retorno = tarefaRep.GetAll(c => c.status == 0 && c.id_empresa == idEmpresa && c.id_cliente.ToString().Equals(idCliente) &&…
-
1
votes2
answers61
viewsRestart low-priority service on the third core in C#
I have a job running on the machine in production. This service sometimes gets "stopped" and the easiest solution is to restart the service, and it continues to function as expected. Is there any…
-
1
votes3
answers83
viewsHow to make a max + 1 with lambda or Linq, but with tables from nothing, all null
I made this method and other attempts. With the table filled, ok, but with the table without data, it is giving error: public int GeraIdBalanca() { int chave = 0; var obj =…
-
1
votes1
answer58
viewsTransforming a content into an image
I’m creating a project in Windows Forms to help my company generate automated email signatures for our employees. I have in the case a single windows Forms that contains a Tab Control, with Data and…
-
1
votes3
answers4984
viewsGet the highest value from a list?
I need to generate 100 random values, save to a list (List<>) and catch the most number. How do I get the most numbers?
-
1
votes0
answers1093
viewsRun minute to minute routine with C#
Good morning, I have a problem that I have not been able to solve, I have a routine that will monitor an equipment every second and when it turns the minute the system will perform the desired…
c#asked 8 years, 7 months ago Ronaldo Lopes 453 -
1
votes1
answer672
views -
1
votes0
answers32
viewsIdentify skype instances using SKYPE4COM.dll library
I’m working on a project C# WindowsForms and using the library SKYPE4COM.dll. I made an application that looks for an instance of skype running, the problem is that when assigning the instance as…
-
1
votes0
answers46
viewsShow results of a Stored Procedure
I want to show the result of the trial in a List I added it to the model and generated this code. public virtual ObjectResult<string> SP_ListaDadosCarteiraPGC(Nullable<int> ano,…