Newest 'c#' Questions

Q&A for professional and enthusiast programmers

TCP/IP multiple clients connection in C#

I wrote client and server apps, there are those codes: Client: using System.Net.Sockets; using System.Net; using System.IO; using System; using System.Collections.Generic; using System.Threading; ...

Hashing Json result to detect changes

I get JSON results and parse them to models and store them in database. I need to check if the result is new to insert, or if it has changed to update existing data. Consider that I am getting JSON ...

how can i scale only the left side of gameobject? [duplicate]

using UnityEngine; using System.Collections; using System.Collections.Generic; public class Test : MonoBehaviour { public GameObject gameObjectToRaise; public float raiseAmount; public ...

Text Changed Event not working

i have 3 textfields.. 1st)quantity of items..textfield name - tot_qty 2nd)price of item..textfield name - price 3rd)total price..textfield name - tot_price i want that.. when i enter a particular ...

How can I get return value from HTTP get method in web api controller using OwinMiddleware?

I have web api SomeController and HttpGet method that returns string on api call. public class SomeController : ApiController { [HttpGet] public string Get() { return "Hello World"...

PointF array has all values the same

On every new click I get new coordinates and save them in points but it also changes old values. For example First click: points[(156, 25), (0, 0), (0, 0)] Second click: points[(85, 92), (85, 92), (...

Use of unassigned local variable 'table'. C# [duplicate]

so, I keep getting an use of unassigned local variable 'table' error when debugging my code. I'm trying to make an multiplication table. Here is the look of my code; using System; using System....

APPlitools: 401 unauthorized is displayed during the execution of checkWindow() function

I used the code below from your website and also provided my APIKEY from my account. Te url is launched and the browser size is also set. When the first checkWindow() function executes , I get a 401 ...

IEnumerable batching discrepancy in Count() value

I am trying to batch the IEnumerable<T> in equal subsets and came across following solutions: MoreLinq Nuget library Batch, whose implementation is detailed here: MoreLinq - Batch Another ...

CS7069 Reference to type 'Component' claims it is defined in 'System', but it could not be found

I am currently to connect my project to Microsoft Access DataBase in my project. I added System.Data.dll as the reference so the OleDbConnection command can be work but the command conn.Open() has ...

Use derived class property in base class constructor

In following code, I need Base class constructor to use Derived class property ServiceUrl. I cannot define ServiceUrl as static as it's value is computed based on Derived class constructor argument. I ...

Unable to add response.write() in action method

Am trying to download bulk excel data so am using server.mappath() to save the file but problem is file is downloaded to the specific folder but i didn't get the download file in the browser. so how ...

Save DataGrid data into DB

I have one update button in DataGrid, and I want to update data in database With the help of DataGrid update button, the name of update button is SettingsUpdateDataGridUpdateButton. I have table ...

How to create .vcf file programmatically using C#

I have a program that generates thousands of numbers and I want to create a contact file for them using C# ,so is that possible without using xamarine framework?

Inserting PRIMARY Key value into SQL without duplicating the CHAR via ASP.NET

Once again needed help from you experts, Heres the design SQL MemberID CHAR(8) The memberID usually is "M1" "M2" and so on However when I add into SQL via ASP.NET The command would be something ...

Cant solve Kattis. Cant think of more options

Im trying to solve "Quite a problem" https://open.kattis.com/problems/quiteaproblem but im getting Wrong answer when i submit the solution. Have i missed something in the description? Im thinking ...

How to sort SQL Column Primary Key

SQL Hello guys, Please check the image above, how do I make sure that the "C10" will comes after "C9" Thank you

Get notified about manually clicked links in Selenium WebDriver using C#

I'm using the ChromeWebDriver together with Selenium. The application is partically controlled automatically. Now I want the user to navigate to a page, where he has to choose a link from some list ...

Notifications for WinForms / WPF application

I have a Windows Forms client application. The application uses built-in WebBrowser to display a ASP.NET Core locally hosted site. The client does not have a persistent Internet connection (sometimes ...

Unity Photon PUN calls a wrong method

I have two scripts. First script is named Launcher. It's derived from Photon.PunBehaviour and designed to work only with PUN methods. Also I have another script that is named LauncherUI and derived ...

IEnumerable<T> processing instead of List<T>, can deferred execution cause issue

In the code, I process IEnumerable<T>, persisted to the in memory cache, where first time it goes to database and fetch the result as IEnumerable<T>. Data processing includes the following ...

namespace not found in xaml, but can be used in C# code

I have a WPF Project Home,it will reference a library project which defines namespace 'LibraryProjectExample', I want to use it in the Home Project,the namespace can not be found: xmlns:view="clr-...

C# Limiting setter value

I'm currently trying to implement properties and in particular limiting my setter. For example, i have a 'Money' float field that i'd like it so you can add/subtract values to it but when it's at 0 ...

Prevent stackframe being created in C#

I was just doing some reading on performance of recursive functions in csharp. I read that recursive functions are expensive due to stack-frames being created upon each call. Is there a way to ...

c# devexpress xtragrid column format

I am trying to set custom format of column within XtraGrid component: public class Customers { public object A { get; set; } } Customers c61 = new Customers(); c61.A = DateTime....

please help operation right nodes smaller and left nodes bigger

i have a test tommorow and i need to write operation that return true if the right nodes are smaller than the Head and the left nodes are Bigger than the Head. i tried to check it but it return false ...

How to open detail view after click on map pin in xamarin.forms?

I'm currently developing a mapview-app with Xamarin.forms and I'm having some problem: I have a custom map (because of custom pin-icons) I have a view with a map inside (where the custom pins are ...

Do you need to run a Selenium Server with RemoteWebDriver in order to perfrm the step “Run Functional Tests” in TFS 2017 vnext build?

I have been able to run Selenium test locally on my test machine using a simple webdriver setup such as IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.testedApp.com"; and running ...

Ready only access dynamically in entity framework UnitOfWork and DbContextFactory

I am working on MVC project and I am using entity framework with Repository pattern approach. Now I am wan to implement read only access to application. So is there any generic way I can implement ...

cannot convert from 'system.windows.forms.messagebox' to 'string'

I have the following code: public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string code = "111-222-73"; if (...

c# exception “not all code path return a value” [duplicate]

Hi all I have a method to update my MySQL. I'm using a MS Visual Studio public static User updateUser(string name, string passwd) { MySqlConnection connection = new MySqlConnection(conn);...

Excel importing to c# windows application

I have an excel sheet with more than 10 tables, and I would need to import those tables into a c# windows application. I started to do the same by trying to import these tables into a datatable in c#. ...

How to draw a bitmap via Graphics.DrawImage() without blinking

I am making a simple C# game. I tryed to use PictureBox as sprite, but it hasn't got transperency, so i had to use Graphics. The trouble is that image is blinking, when it's drawn too many times. Here ...

C# - Serializing private property as attribute (Data Contract)

After learning I can't serialize private properties in a class, I started using DataContract and DataMember annotations. I have a private string property in my class that I would like to serialize as ...

Async Task in WPF

I tried to run a task for a WPF UI Code Behind . but it doesn't work and noting happend when I use Task.Factory but it works when I use the code without Task.Factory public MainWindow() { ...

Taking screenshot of dynamically opened windows form c#

I have the name of the form in variable and I need to show that form, take a screenshot of it, and convert it to bytes so i can save it in database. My code is something like this: var form = (Form)...

Make Imported Library Internal

I have a DB repository library which I import to another library project. The DB library contain public models which I don't want it to be exposed to other projects that use the second library is ...

Edit file properties in PDF with GemBox.Document

How can we modify all properties in PDF file? I've seen the document properties example and ended up with this: DocumentModel document = DocumentModel.Load("Input.docx"); document.DocumentProperties....

C# Linq to SQL vs Entity Framework .Net Core

I decided to start learning something about .Net Core and Entity Framework for Core. Since most of our apps rely heavily on data access, I decided to start with the Entity Framework for .Net Core. ...

SQL Server does not exist or access denied while importing data from Excel into SQL Server [duplicate]

I tried to import Excel file dynamically depending on user's choice. I want give permission to user to select which table in the database he want to add in this. This is my code when I select the ...

Paste SQL-staement from clipboard containing image as byte[]

I'm user of an application with an Access backend. The application allows me to fire SQL-Statements via textbox against the database. That's working. It's also working to let c# convert a jpeg to ...

Loading a grid in xaml code from a file, then making it active in main code

I am making a video game, where each grid serves as game room. Each grid\room has a large number of objects like things that can be used, images and sound files. Until now, they all were stored in one ...

How to update data in to database in faster way in .net

I am taking 50000plus data from one table in oracle DB and storing in to a datatable in c# after doing some operations,then i am updating in to another table in oracle database.Here the question is ...

I tried to login to user account and my login returns back to login page

This is the code i used for the Login page This is the code i used for the user page

C# Delete all files in a listbox

I add some files to a listbox on a button: if (Directory.Exists(DirString)) { DirectoryInfo dirETC = new DirectoryInfo(DirString); FileInfo[] Files = dirETC.GetFiles("*.txt"); foreach (FileInfo file ...

Long running initialisation of class fields in constructor

Say I have the class below public class MyClass { private readonly NinjaObject _myNinja; MyClass(NinjaFactory ninjaFactory) { _myNinja = ninjaFactory.CreateNinjaButItTakesTime(); ...

C#: HttpListener request InputStream is always an empty stream

I am trying to build a very simple web server with C#. I used HttpListener and so far i got it up and running. But when i try to get InputStream of request, i always encounter NullStream, no matter ...

XmlReader: Not reading sibling child elements

Following is the code: string str = "<A><B>Apple</B><B>Mango</B></A>"; using (XmlReader xmlReader = XmlReader.Create(new StringReader(str))) { while (...

Azure Event Hub Client prevent asp.net Web Application from loading

I am using an Azure Event Hub as backplane for my SignalR Web App (asp.net mvc, 4.5.2). I have some problems with creating a client that can listen for messages. I can get the same code to receive ...

Unsupported media type ASP.NET Core Web API

On the front-end i use Angular to collect som data from the form and send it to my server-side controllers. As the image shows below, i get the data ($scope.newData) on my controller and service, but ...
Translating... 0%