visual-studio-2012

An attempt was made to load a program with an incorrect format

人走茶凉 提交于 2019-12-13 08:18:49
问题 I am using C# loading C++ dll, and got this error: "An unhandled exception of type 'System.BadImageFormatException' occurred in MyApp.exe" "Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8057000B) I could not figure out why. The C++ dll was generated using vs2012 wizard, win32 application, dll with pre-head. It is built with x64 option. Here is the code: // MyNativeDLL.cpp : Defines the exported functions for the DLL

test case writing in c#

十年热恋 提交于 2019-12-13 08:09:47
问题 [HttpGet] [Authorize] public ActionResult Create() //loads the form { var categoryList = new SelectList(new[] { "Electronics", "Toys","Books","Sporting Goods"}); //defines the categories ViewBag.CategoryList = categoryList; return View(); } I write a test method for this.. [TestMethod] public void TestCreate() { AdvertisementController controller = new AdvertisementController(); var categoryList = new SelectList(new[] { "Electronics", "Toys", "Books", "Sporting Goods" }); ViewResult result =

Change keyboard layouts through code c#

余生颓废 提交于 2019-12-13 08:03:49
问题 i am developing a multi-lingual application allowing users to change language as well as keyboard layouts (through combobox). I am able to change the culture of application successfully but i'm unable to change the individual keyboard layouts e.g. for English (United States), im unable to change layouts from QWERTY (default) to Dvorak - Left hand etc.. Plz help me in this matter. Thanks alot Here's the code (e.g. for English language), the imports etc are added already.. CultureInfo

Setting up SSIS Item Template in SQL Server Data Tools for Visual Studio 2012

老子叫甜甜 提交于 2019-12-13 08:02:04
问题 I have created a dtsx file to use as an SSIS package template. I want to be able to use the file as a template by clicking on an open Project in Solution Explorer and selecting Add -> New Item My questions are: How do I save this as a template file? Its currently a .dtsx file. Where do I have to place the file so its in my list of options in the Add New Items dialog? I have seen many conflicting paths and none specifically for SQL Server Data Tools for Visual Studio 2012. I have searched for

Memory leaks despite destructor call

北城以北 提交于 2019-12-13 07:43:31
问题 I'm working on a class LinkedList which looks like this: private: LL_element* first; LL_element* last; int size; public: //constructor Linkedlist(): first(NULL), last(NULL), size(0) {} //destructor ~Linkedlist(); //adds element at the end of the list. void push_back(int value); //removes an element at the end of the list. bool pop_back(int& value); The function push_back creates a new LL_element object (dynamically allocated). The function pop_back explicitly deletes the element at the end of

How to set click event for notification Windows 8.1 C#

早过忘川 提交于 2019-12-13 07:42:52
问题 I am new to Windows development and I have created a Windows 8.1 application using C# and xaml on Visual Studio. I have created a toast message. var template = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); var element = template.GetElementsByTagName("text")[0]; element.AppendChild(template.CreateTextNode("INR BUDDY")); var element1 = template.GetElementsByTagName("text")[1]; element1.AppendChild(template.CreateTextNode("You have a message!")); //set the toast to

catch mysql-exception using .Number

北战南征 提交于 2019-12-13 07:26:49
问题 I want to catch a specific mysql error with the number 1046. If i use MessageBox.Show to display the error number it is always 0, no matter which Exception it is. Shouldn't the Exception have a number like the number 1046? catch (MySqlException mysqlex) { MessageBox.Show(mysqlex.Number.ToString()); } EDIT: Sorry, i am using the MySQL-Connector / Net. 回答1: You don't see a number because you did not connect to a database. And probably MySQL is assigning numbers to error exceptions. If you look

Error when adding web service reference in VS2012

回眸只為那壹抹淺笑 提交于 2019-12-13 07:23:51
问题 I am trying to add a reference to a web service for a new project in VS2012. I keep getting the below error: There was an error downloading 'ServiceAddress/ConfigurationMgmt.wsdl/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: 'ServiceAddress/ConfigurationMgmt.wsdl'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was

Cannot access private member declared in class 'CObject'?

南楼画角 提交于 2019-12-13 07:19:04
问题 class EventDataValue { public: enum Types { NONE, INT, STRING, DOUBLE, ULONG }; EventDataValue() { this->Type = NONE; } EventDataValue( const EventDataValue &s ) { this->Type = s.Type; if (this->Type == INT) this->i = s.i; else if (this->Type == STRING) this->s = s.s; else if (this->Type == DOUBLE) this->d = s.d; else if (this->Type == ULONG) this->ul = s.ul; } EventDataValue& operator=( const EventDataValue &s ) { this->Type = s.Type; if (this->Type == INT) this->i = s.i; else if (this->Type

Using this keyword in c# Visual studio vs Stylecop [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-13 07:08:34
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . I am working on a windows service C# project and I am working first time in C#. An I am getting 2 different suggestion from VS as well Stylecop for a same this keyword. (I know, this keyword refers to the current instance of the class) So I removed this keyword, and I am