[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Microsoft Visual Studio





Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Folks,

I'm starting to get myself in C#, I am as far as writing my own basic "hello world" sample ;) -see below
IDE: Visual Studio Community 2017
PCs: Laptop, Desktop
Problem: when I write and test the code on computera everything works as it should, but when i copy the same folder files incl. the my test.cs onto another PC the debugging feature becomes disabled(-see figa) and if i try to run it from the play button it brings me to a "attach process"... (-see figb)
Background experience: Powershell, Bash, Batch.
Odd solution?: copy/paste the content of the file onto a new one and then save it then run it..., is this normal, or am i doing something wrong?  

By the way does anybody have a link to a cheatsheet for c# with basic commands?

    class Program
        static void Main(string[] args)
            //The Code always starts Here
            //This example is to various methods to write txt
            Console.WriteLine("Hello I'm at your service. \n2ND Line This is a new line");
            Console.Write("Press Any Key to Continue"); 

            //This example involves variables TXT , (this involves declaring variables first)
            string greeting, who;
            greeting = "Salut, ";
            who = "Mon Ami";
            Console.WriteLine(greeting + who + "!");
            Console.WriteLine("Press Any 

Open in new window

JavaScript Best Practices
LVL 12
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

SQL 2012 - Visual Studio 2012

I have created a report in Visual Studio that has one field that is a Decimal (19,9) that I have it displaying as a blank if the number is zero.  There are a lot of zeros in this column.  I need to count the number of zeros.  How can I achieve this?
Hi, I like to use  a brake point for debug.  Never had a problem with it until I started to work on VS 2017 (Professional ).
Now no matter where I put a brake point it is never hit.
Do you have any idea how to fix this?
I am teaching myself visual studio with visual basic. Please help a newbie.

I have a connected sql table setup as follows
TABLE [dbo].[Suffix](
      [SuffixID] [int] IDENTITY(1,1) NOT NULL,
      [Suffix] [nvarchar](3) NOT NULL,
      [myCount] [nvarchar](5) NULL,

I created a visual basic windows form in visual studio.  the save button on the form as the following code behind it in the click event.
            cmd.CommandType = System.Data.CommandType.Text

            cmd.CommandType = "insert into Suffix values ('" & TextBox30.Text & "', '" & TextBox28.Text & "')"
cmd.Connection = con
            MsgBox("Succesfully added", MsgBoxStyle.Information, "add")
        Catch ex As Exception
        End Try

I keep getting the following error Conversion from string "insert into suffix value ('txx'" to type 'integer' is not valid.

How do I fix this?
Is it possible to create an SSIS package in Visual Studio with the Server Name and Data Source in the Source object as a parameter, so that you can provide the SQL server name at runtime?
Installing the Visual Studio 2017 community edition, I realise I need to tidy up my PC in terms of previous Visual Studio installs (see below).  Is it simply a case of uninstalling, via Windows 10 Programs, the older editions, or are their shared programs I should be careful about?Screen grab

I am developing an application using JetBrains CLion 2018.2.4 with cmake 3.12.2 and Visual Studio 2017 compiler.
Let me set up things first.

Here is the base class:
class Header
   enum MessageType
      Message = 100,
      Command = 101,
      InvalidMessage = 102

   Header(Header::MessageType messageType);
   virtual ~Header() = default;

   Header::MessageType GetMessageType() const;
   Header::MessageType m_messageType;

Header::Header() :

Header::Header(Header::MessageType messageType) :

Header::MessageType Header::GetMessageType() const
   return m_messageType;

Open in new window

Here is the derived class:
class Message : public Header
   ~Message() = default;

   void SetMessage(std::string message);
   std::string GetMessage() const&;

   std::string m_message;

Message::Message() :

void Message::SetMessage(std::string message)
   m_message = message;

std::string Message::GetMessage() const&
   return m_message;

Open in new window

Here is how I'm acessing the function GetMessage();
int main()
   Reader reader;

   auto basePtr = reader.ReadAll(message);
   auto derivedPtr = std::dynamic_pointer_cast<communication::Message>(basePtr);
   std::cout << "read: " << derivedPtr->GetMessageType() << ";" << derivedPtr->GetMessage();

Open in new window

When I try to execute GetMessage() like up above, I get the error below:

Server.cpp.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall communication::Message::GetMessageA(void)const & " (?GetMessageA@Message@communication@@QGBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function _main
Server.exe : fatal error LNK1120: 1 unresolved externals

Open in new window

It has to do with the function GetMessage() but I'm failing to see what is wrong. If I remove that call, everything compile fine.
Also, I do the exact same call in other class and it is working fine.
Help is needed!!!
I've just installed Microsoft SQL Express as well as Server Management Studio and Visual Studio.
However when I open the Management Studio and connect and create a database it displays it with a black lock icon.
Is this normal ?
My question is:  Why, when I right click on the selected database and click tasks why are both Import and Export options greyed out. ?
Thanks for your help
I'm trying to get the op numbers from the following filename strings using RexEx which the pattern will be used in VS2017 using the C# language for developing a Windows Form Application. In this application, we are filtering filenames in a datagridview by Op number when searching through a folder directory and all its subdirectories. I'm having an issue trying to get the regex to work on the tester websites I have tried. These are regxr.com and regexstorm.net/tester

Filename1: C-2590-3 REV-B OP#50.pcl
Filename 2: C-2590-3 REV-B OP#50-59.pcl
Filename 3: C-2590-3 REV-B OP#50-59-90.pcl
Filename 4: C-2590-3 REV-B OP#50-59-90-70(Flip).pcl
Filename 5: C-2590-3 REV-B OP#50-59-90 (Flip)60-90.pcl

The text I need to capture is :

Filename 1 Results: 50
Filename 2 Results: 50-59
Filename 3 Results: 50-59-90
Filename 4 Results: 50-59-90-70
Filename 5 Results: 50-59-90 60-90

This is what I have tried on the regexr.com tester:



and I keep getting stuck because it will only show me the 1st two digits "50"

I'm not real familiar with Regex and I thought I should get some help because I'm missing something And don't know what that might be.

Can anyone help with this? Here is a screenshot of the form application running.

Tesa File Search - Screenshot1
Hello Experts.

I have learned from past experience that it can be hazardous to make changes to a back-end data table when it is bound to an existing VB.NET project in Visual Studio.

I would like to believe that it is possible to pull this task off without crashing my project, and would like to seek any advise from the EE community on how to do this.

Specifically, I have a single MDB file which contains a dozen or so tables and queries/views, with all their relationships. Everything is created/designed using MS Access 2016.

I want to change the primary key on one of the tables within that MDB. That would also require removing some of the relationships, and establishing new ones as needed.

Right now, the primary key for the Roster table is sequentially assigned, but the first non-primary field is and always will be unique, so I would really like to change it.

So, I am looking for some step-by-step instructions from someone who has successfully done this within the context of a previously bound Visual Studio project.

As always, don't hesitate to ask if I've left any important details out.

Tony G.
Turn Raw Data into a Real Career
Turn Raw Data into a Real Career

There’s a growing demand for qualified analysts who can make sense of Big Data. With an MS in Data Analytics, you can become the data mining, management, mapping, and munging expert that today’s leading corporations desperately need.

How do I select multiple files in vb.net .The code i am currently using is ;
 Public Function ReturnWordTemplatePath() As String
        '//***This Function return the path where word file template is located ***\\
        Dim strresponse As String
        Dim WordTemplate As String
        ' Dim str As String = "LArrDep"
        Dim dlg As New OpenFileDialog()
        ' Filter by Word Documents

        dlg.Title = "Select Ac to attach"
        ' dlg.FileName = str
        dlg.AutoUpgradeEnabled = False
        strresponse = dlg.ShowDialog(Me)
        If strresponse = 1 Then
            WordTemplate = dlg.FileName
            Return WordTemplate
        End If
        Return String.Empty
    End Function

Open in new window

I am trying to use this code for making an order in Woocommerce, using this add-on :https://github.com/XiaoFaye/WooCommerce.NET. My code is this:  

        var order = new Order() { status = "pending" };
        order.currency = "EUR";
        order.line_items.Add(new OrderLineItem()
            product_id = 44,
        order.customer_id = 1;
       Task ord = wc.Order.Add(order);
But everytime it gives me this exception:
System.NullReferenceException: 'Object reference not set to an instance of an object.'

I have tried everything but no success...
I have a situation where i need to reproduce a complex SSIS package with varying degrees of differences but for the most part 60% of it is the same across all permutations.

The problem being is each one needs to be recreated from scratch. If any copy and paste is done then it results in METADATA errors when i test in the DEV environment but even more so when i deploy to production.

This quickly turns into a nightmare.

Has any one developed any clever ways to resolve the SSIS METADATA errors that doesn't require either creating each package from scratch  or opening, building, saving, and closing each and every task?

Thank you.
I have the following VB Script Task in an SSIS package.
It takes a set of variables  (ScriptPath, uName, Pwd, etc) and builds a shell command .
The package is not executing successfully.
I want to somehow be able to output the final text that is presented to the Shell so I can examine it, and possibly try to run it outside of the package.
Any guidance in how I can output this text, possibly a log file? Or output to the screen when running the package on Debug mode in visual studio?

' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic 2008.
' The ScriptMain is the entry point class of the script.

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime

<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
	Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

	Enum ScriptResults
		Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
		Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
	End Enum

	' The execution engine calls this method when the task executes.
	' To access the object model, use the Dts property. Connections, variables, events,
	' and logging features are available as members of the Dts property as shown in the following examples.
	' To reference a variable, call 

Open in new window

we are going to migrate a vb6 project to vb.net or c#.net. I want to use a converter tool at least for the screen drawings. did anynoe try  Microsoft Visual Studio 2008 expressfor that purpose?
Need a Windows Forms User Interface to enable OCR User Error Checking

I am in the process of writing a Windows Forms application (in C#) that will use an external OCR module to perform OCR on a PDF containing scanned financial documents. So, I expect there to be errors. But, I want to provide the scanned results to the user in a format where the results can be cross-checked by the user.

Clearly, typing over with the corrected value is key.

What is the easiest way to do this in a Windows Forms program?

Various forms will have different values, so I want this as generic as possible.

Shall I just display the whole block of data as a multi-line text input field?

Any other ideas?

Hello Experts,

I have charitably be bestowed a new job responsibility... cleaning up someone else's mess.  I have problem with some IIS websites with varying aging technologies in use.  One problem is that the production website server has been the developers test environment for several years before my time.  I need to get this cleaned up.  Transferring the websites leaves me with websites that won't start; listing dependencies that I can only find referenced in the bowels of older versions of visual studio.  

Transfer tools aren't helping (I purchased IEMT7 and *That* errs out in the middle of a transfer)  

Anyways,  I am trying to find the right way to get this cleaned up.  I need a production server running the websites without half a million developer installations of obscure software.

So should I have the developer publish the websites from the cursed server to a new server?  Will this take care of the dependencies?  Is there some magic bullet tool out there that will take care of this semi cheaply?  I am tired of falling on my face with this one, so someone please send me in the right direction.

Thank you in advance,

Hello Again Experts.

I must apologize in advance for my brevity, but I recently injured my hand in the wood shop, and typing is somewhat difficult.

The situation that I am dealing with right now is that I am very frequently experiencing conflict between changes that I make in my Access tables/queries, and keeping my VB.NET Windows Forms app in sync with these changes. For example, if my program is stable with no DB issues, and I decide that I want to add a new field/column to a given table using Access, when I return to my program, it invariably produces errors related to the changes I make.

Today I made a change to an Access Query which is attached to a DataGridView in which I connected a new table to get a related field value. The Query works fine in Access, but now not only does the program fail to compile because of the DGV association, but the Data Source Configuration Wizard shows what before was a View is now a broken Table!

I'm pretty sure that Visual Studio stores a boatload of data pertaining to my database, and that needs to agree with the MDB file, so I just need to know that correct way to make minor changes to my tables and queries. Ultimately what I'm hoping to accomplish is to find a way to have ONE source for my database definitions, and just have a file (or files) store the data.

I realize this is not a lot to go on, but that's all I can offer for the moment.

Many Thanks,
Tony G.Example Error Condition
How do I add a autonumber  column to the datatable.
Id ColName
1   abc
2   gfg
3   grg
4 ggg

ID should be autoincrementing column.

Firewall Management 201 with Professor Wool
Firewall Management 201 with Professor Wool

In this whiteboard video, Professor Wool highlights the challenges, benefits and trade-offs of utilizing zero-touch automation for security policy change management. Watch and Learn!

I need to know a few things about the following:

Microsoft Visual C++ 2013 Runtime Package for Windows

- filename of the DLL
- Is it available as a NuGet Package?
- If this is missing, how do I include it in my C# mobile app?
-  If I installed the Windows 8.1 SDK - what would be the path to this file?

Thank you!

I've created a visual studio 2017 with two webform projects in C#.  I've zipped it up and its over 40mb.  How do I make it smaller?  My actual code is only about 200 lines, but there are so many packages and scripts etc.  I'm working with C#, but am not sure if the same would apply to vb projects.
I have been tasked with creating some reports out of VS and SSRS from an Oracle 12c database.  I am an Oracle developer but I don't know much about VS or SSRS.  I have both VS 2015 (14.0.25431.01 Update 3) and 2017 (15.7.5) installed and I have installed ODTwithODAC for 12c.  I have also installed SSDT for both VS 2015 and VS 2017.  

Using VS 2017, i have created a new project but I am unable to create a shared data source.  As soon as I select Oracle Database in the Type drop-down, the Edit button next to the connection string becomes grayed out.  

Using VS 2015, I have cloned an existing project that works fine for my colleague.  However, when I first tried to load the project I received a message that the version of the report server project is not supported and the project must be upgraded.  If I say no, then the project won't load.  If I say yes, the project loads and everything seems to be ok. However, when I try to Preview an existing report from the project, I receive the following error:
"An error has occurred during local report processing.  An error has occurred during report processing.  An attempt has been been made to use a data extension 'ORACLE' that is either not registered for this report server or is not supported in this edition of Reporting Services."  There is nothing in the Error List when this happens.  

The only difference between my colleague's setup and mine is that he has SQL Server Reporting Services 14.0.806.134 and I have …
Hi all.

I have the following sql query in my Visual Studio application the data is displayed the following way:


but I want to change the order of the columns to be:


Any idea how I can do this? Thank you in advance!

        Year,ProductLine, Sales,TotalYearSales AS [Total Sales]
           FROM CRMProductLineSales
           WHERE PMID = '55655'
) as s
(	SUM(Sales)
    FOR ProductLine IN (ABC, DEF, GHI)
)AS pvt

Open in new window

I have a .Net Framework (4.6.1) class library project (call it A).
Then I have a UWP app (call it B), and I want to use the code in A by referencing to A from B. But that is not possible. UWP apps are .Net Core and not compatible with .Net Framework.

So I created a .Netstandard 2.0.3 class library project (call it C), to be a proxy between A and B. I now reference from A (the UWP app) to C (the .Netstandard class library), and then from C to B (the .Net framework class library).

Everything compiles now, but when I run/debug the UWP app in Visual Studio I get the following error originating from the code in A:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Web.ApplicationServices, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.'

System.Web.ApplicationServices is a .Net Framework reference in A, and is not compatible with B. I was hoping to get around this by using .Net standard and C as a proxy between A and B.

Any suggestions on how to fix this?

Code examples won't help here, the code works fine, but not the integration between the various technologies.
I'm trying to use iMacros with C# in Visual Studio 2013
my code:

using iMacros;


           iMacros.AppClass imApp = new iMacros.AppClass(); // Object aanmaken van de namespace iMacros class AppClass
            iMacros.Status imStatus;

Open in new window

got an error:

interop type iMacros.AppClass cannot be embedded.

What could I do to resolve this?

Microsoft Visual Studio





Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.