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

How to create a picture box at time on a word document . Also How can I add caption as a header on the picture box.
Please find the code I am using currently with my windows app.
   Dim imageData As Byte()
        Dim image As Image
        Dim strFormId As String
        Dim objDoc As Word.Document

    If IsNothing(objWordApp) = True Then
            objWordApp = New Word.Application

            '  oWord = CreateObject("Word.Application")
            objWordApp.Visible = true         
        End If
        objDoc = objWordApp.Documents.Add()

  For j = 0 To dtSQLImage.Rows.Count - 1
                        imageData = dtSQLImage.Rows(j)(0)

                        If Not imageData Is Nothing Then
                            Using ms As New MemoryStream(imageData, 0, imageData.Length)
                                ms.Write(imageData, 0, imageData.Length)
                                    image = Image.FromStream(ms, True)
                                Catch ex As Exception
                                    Exit For
                                End Try

                                ExportToWord(image, objWordApp, objDoc)

                            End Using
                        End If

Open in new window

  Protected Friend Sub ExportToWord(ByVal image As Object, ByVal objWordApp As Object, ByVal objDoc As Object)


Replace:=Word.WdReplace.wdReplaceAll) ''''''
            Dim oldbitmap As Bitmap = (image)

            Dim newbitmap As Bitmap = New Bitmap(CInt(400%), CInt(400%)) 'Compress the image
            oldbitmap = oldbitmap
            ScaleImage(FrmMain.PicImage, oldbitmap)
            Dim g As Graphics = Graphics.FromImage(newbitmap)
            g.DrawImage(oldbitmap, 0, 20, newbitmap.Width, newbitmap.Height)
            Dim pathToSavedImage As String = "C:\Users\admin.test\MergeImage.docx"
            newbitmap.Save(pathToSavedImage, Imaging.ImageFormat.Bmp)


            Dim ObjPic As Microsoft.Office.Interop.Word.InlineShape = objDoc.InlineShapes.AddPicture(pathToSavedImage)
        Catch ex As Exception
        End Try
    End Sub

Open in new window

Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

I am trying to build a Visual Studio VB WindowsForm project that uses DAO to access a 2016 .accdb database file.

I have added the reference Microsoft.Office.Interop.Access.Dao from the Access.16 Office dll.

My code:

Option Explicit On
Imports DAO = Microsoft.Office.Interop.Access.Dao
Module Module1LoopThroughStandard
    Public Sub LoopThrough()
        Dim de As New DAO.DBEngine
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        Dim strSQL As String

        db = de.OpenDatabase("c:\Project\database.accdb")

        strSQL = "SELECT * " & _
                   "FROM Table1"

        rs = db.OpenRecordset(strSQL)
        With rs
            If .BOF Then
                MsgBox("Oops, not working")
            End If
        End With

        rs = Nothing
        db = Nothing
        de = Nothing

    End Sub
End Module

Open in new window

I get the following COM Exception:

System.Runtime.InteropServices.COMException was unhandled
  Message=Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, …
Issue adding a local wsdl file for royal mail to visual stusio 2017 in c#.
Print screen f error attached. Invalid URI.
Hi All,

I have a GL project. This a project will be called by any other project.
One of the feature is showing forms from other project, for example form for sales order :

1. At project A is frmSalesInvoice
2. At project B is frmSalesInvoiceWithRoll

How could I solved this problem ?

Thank you.
How do I get Visual Studio 2017 to validate <script> tags in source code with CORS attributes?

Okay, this is an annoyance rather than a life or death problem!  I am working on a website which uses externally hosted scripts in some of its pages.  The script tags have CORS attributes (integrity and crossorigin).  Visual Studio is validating the code against the HTML5 schema.  So Visual Studio is picking these up as warnings in its error list and underlining the code with green squiggly lines.

I know I can just ignore them, or turn validation off.  I'd prefer to have them recognised as valid markup.  Is there any way that I can do that?
What is the difference between ASP.NET Web Application Visual C# (.NET Framework) and ASP.NET Web Application(.NET Framework) Visual Basic when it comes to developing a web page.  I am trying to convert a desktop VB6 application and want to start off on the right ASP development page.  I am in the process of learning Visual Basic again.  

Also, I see a .NET Core version, so what exactly am I looking at as this can be quite confusing as to where I should begin?
In Visual studio, is it possible to make a Windows Form Desktop application that can also be executed from a Mac?  Or can that only be done from making a web page such as ASP.NET Web Application
Daily I deal with serveal webpages, and Dreamweaver does the job with the "manage sites" and the pontial to switch between "local" and "remote" files.

Is this some how possible in Visual Studio?

If I open webpage by FTP in VS, I can´t look at local files and upload a local folder to the FTP.
If i create a project and connect Webpublish, I can´t see the remote files.
Unable to run the WPF application from windows startup. Do I need to specify the application startup folder or application folder in the config file?
My setup is located in d:\app\crm\ folder. But my desktop shortcut is working fine.

Registry: setup


value name: CRM-DEMO
value data: "d:\app\crm\crm.exe"
OS : Windows 10

 I am still getting

To add more information :
 If there are column names at the end of  the excel sheet , and there is no data in that column (cell) it comes with the blank with ','
Basically it should detect that there is no data after this column and stop adding the comma (,,,,)

How can I avoid this at the end of the column with used range.

The code I am using in is :

        Dim officeType As Type = 

Open in new window

Has Powershell sent you back into the Stone Age?
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Hi I am trying make a deep copy of the structure below which will contain the decoded video frames and copy to a new element in a vector without each previous element being overwritten.
The structure below is being populated as the memory in debug mode is increasing as expected with each pass of the while loop.
struct YUV_Buffer
mfxFrameSurface1  *mSurface;
YUV_Buffer(mfxFrameSurface1 *pBuf = { 0 })
    : mSurface(new mfxFrameSurface1[sizeof(mfxFrameSurface1)])
    memcpy(mSurface, pBuf, sizeof(mfxFrameSurface1));

YUV_Buffer(const YUV_Buffer& YuvBuf) 
 : YUV_Buffer(YuvBuf.mSurface)  

YUV_Buffer& operator = (YUV_Buffer YuvBuf) {

    std::swap(mSurface, YuvBuf.mSurface);
    return *this;

~YUV_Buffer() {

Open in new window

I am calling the structure and copying the elements into the vector with each iteration of the while loop "mfxFrameSurface1 pVPPSurfacesOut[nSurfIdxOut]" contains all the information regarding the decoded video frame I need to copy pVPPSurfacesOut[nSurfIdxOut] to the vector mBuffer.push_back(root) using a deep copy so the data that the pointers in the structure are pointing to are also copied but what is actually happening is the last frame processed is overwriting all previous elements in the vector. Each time the loop passes like this: I have removed the code that is decoding each frame as its no relevant I just need to work out why the elements are getting overwritten in the vector
std::vector<YUV_Buffer> mBuffer;
YUV_Buffer root(pVPPSurfacesOut[nSurfIdxOut]);

Open in new window

each iteration of the while loop populates pVPPSurfacesOut[nSurfIdxOut] structures which contain pointers with video information like height width buffersize … and the video data its self in a NV12, YUV420 colour space, I need to access each frame from the vector mBuffer but when I try to access the vector mBuffer[0]… Im getting the last frame copyed to the vector.

Regards Nigel
Creating an SSIS app with VS 2015.  Finally have the pieces connected.  When I run it I receive the below error.

Failed to start project (Microsoft Visual Studio)


Error starting debugging. (Microsoft.DataTransformationServices.VsIntegration)

Program Location:

   at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.LaunchVsDebugger(IVsDebugger iVsDebugger, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.ValidateAndRunDebugger(Int32 flags, IOutputWindow outputWindow, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchDtsPackage(Int32 launchOptions, ProjectItem startupProjItem, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchActivePackage(Int32 launchOptions)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchDtsPackage(Int32 launchOptions, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.Launch(Int32 launchOptions, DataTransformationsProjectConfigurationOptions options)


Unable to 

Open in new window

I have a c# windows form project. I want the form to maintain the aspect ratio if the user grabs the resize grip in bottom corner. In other words for the form to resize diagonally only. Does anyone have a sample code or class to perform this?

I am using Visual Studio 2017 pro with a c# .NET 4.6.2 winform project.
Windows Forms template missing after installing Visual Studio Community 2017. I installed the .Net Development Environment along with the Universal Windows Platform Development. When I did the installation I did chose Run as Administrator.  What can I try to be able to create new Windows Forms applications? If necessary, I will uninstall the whole thing and start over.  I did just download the latest VS Community 2017 install package.
I am using desktop version, need to convert a excel sheet to csv.
Need to calculate the used range of excel and convert it into comma seperated csv.

***Please note speed is an issue here, if you suggest any code with high performance it will be appreciated the most.
How to Set TextBox.Text Value while TextBox bind with MVVM in WPF?
Dear All,

I am looking for database code analysis tool. Could you suggest best suited one?
Like SQL Prompt, SQL Cop, SQL Enlight, or other tool.

FYI, in Visual Studio SQL Server Database Project, we have code-analysis feature but very less rules (only 14). Of course, we can create custom rules. But it's time consuming.

So, Could you suggest best third party tool for SQL Server database code analysis? Can that third party handle for MySQL, Oracle etc. databases too?

Best Regards
I have manually edited an rdlc report script to add 3 new columns to the rdlc report. I did this by making sure the data retrieval query contains the columns and by
manually adding a <fields></fields> entry for each new column in the rdlc script. The new columns do not display on the report but rather a blank space shows on the report where the new columns should be. I searched Google and determined that I may need to rebind the data source. However, all the information on rebinding that I found uses a report design tool. How can I rebind the new fields without using a report design tool?
I need help with creating an expression that will change the font color and make it bold based on if the field is less than today's date.  I am using Visual Studio 2012.  I have a datetime field that I only want to filter on the date.

The last expression I attempted was =iif(Fields!estimated_date.Value < GetDate(), 'Red', 'Black'   I get an error GetDate is not delcared.
IT Degree with Certifications Included
IT Degree with Certifications Included

Aspire to become a network administrator, network security analyst, or computer and information systems manager? Make the most of your experience as an IT professional by earning your B.S. in Network Operations and Security.

Hi I am having problems with a vector that I am populating each element from a structure but the elements seem to be getting partially over written Here is what I am drying to do
struct YUV_Buffer
	void *pCacheBuf;
	int frameID;
	int height;
	int width;
	YUV_Buffer() { pCacheBuf = NULL, frameID = 0, height = 0, width = 0; }

Open in new window

        YUV_Buffer *nBuffer;
	vector<YUV_Buffer> mBuffer;

Open in new window

Implementing the vector array
Here I create a new instance of the structure from within a while loop each iteration of the loop a new video frame is passed to the structure and then added to the vector as a new element
                        YUV_Buffer *nBuffer = new YUV_Buffer();
			nBuffer->frameID = pmfxInSurface->Data.FrameOrder; // frame number
			nBuffer->width = pmfxInSurface->Info.CropW;                 // frame width
			nBuffer->height = pmfxInSurface->Info.CropH;                // frame height
                        nBuffer->pCacheBuf = pSysFrame;                                     // YUV video buffer
                        mBuffer.emplace_back(*nBuffer);                                      // add structure to vector array
                        SAFE_DELETE_ARRAY(nBuffer);                                            // delete structure

Open in new window

I then for testing that the data in the vector element is correct I do the following with OpenCV
each iteration of the while loop cnt is implemented by 1 and mBuffer[cnt].pCacheBuf) contains the video buffer data
                  cv::Mat picYV12 = cv::Mat(pmfxInSurface->Info.CropH + (pmfxInSurface->Info.CropH / 2), pmfxInSurface->Info.CropW, CV_8UC1, mBuffer[cnt].pCacheBuf);
		  cv::Mat picBGR;
		  cv::cvtColor(picYV12, picBGR, CV_YUV2RGBA_NV12);
		  cv::Mat test;
		  cv::cvtColor(picBGR, test, CV_BGRA2RGBA);
		  cv::imshow("MyVideo", test);

Open in new window

This code works and OpenCV display the video frame in its own window perfectly my problem is I need to load all video frames into the vector array and be able to access each frame individually from the vector but what is happening is that the last element in the vector seems to be over writing all previous elements so I end up with 3000 elements in the vector all containing the last video frame buffer. It seems that its only the buffer array that is getting over written as the frame numbers are correctly assigned to each element.

I then need to call each frame from the vector in any order I wish, I have been trying to do it this way

Open in new window

When I try to open a project in Visual Studio 2017 I get the following error.

C:\Users\rgtur\Desktop\Tarabu\Tarabu\Tarabu.vbproj : error  : The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.  C:\Users\rgtur\Desktop\Tarabu\Tarabu\Tarabu.vbproj

How do I fix this?
How to export a image column of sql server to PDF/word  in
I am using visual studio 2017 windows version.

Debugging PHP in VSCode?

So, I'm trying to debug a PHP SOAP service from a PHP client using XDebug in VSCode (using Wamp Server).
I put a break point on this line in my client:
    $ackxml =  '<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
    $response = $client->ProAddRq($ackxml);

Open in new window

Enter localhost/client.php in my browser...It stops on the break point.
I hit the Step Into button, it goes to marked line below in vendor\zendframework\zend-soap\src\Client.php
    public function __call($name, $arguments)
        if (! is_array($arguments)) {        // goes to this line
            $arguments = [$arguments];
        $soapClient = $this->getSoapClient();

        $this->lastMethod = $name;

        $soapHeaders = array_merge($this->permanentSoapInputHeaders, $this->soapInputHeaders);
        $result = $soapClient->__soapCall(
            [], /* Options are already set to the SOAP client object */
            (count($soapHeaders) > 0) ? $soapHeaders : [],

        // Reset non-permanent input headers
        $this->soapInputHeaders = [];

        return $this->_preProcessResult($result);

Open in new window

I try the Step Over button, goes to the next line:
    $soapClient = $this->getSoapClient();

Open in new window

Try stepping into, try stepping over, nothing. The browser still has a spinning icon. If I stop debugging, I get a Document is empty exception in

I've had nothing but trouble trying to debug PHP scripts. When the hell are they going to invent a way to debug PHP with no headaches? Or am I doing something wrong that doesn't allow me to go more than one level into my code?

PHP.ini XDebug values:
    zend_extension ="c:/wamp/bin/php/php5.6.35/zend_ext/php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
    xdebug.remote_enable = On
    xdebug.profiler_enable = On
    xdebug.profiler_enable_trigger = off
    xdebug.profiler_output_name = cachegrind.out.%t.%p
    xdebug.profiler_output_dir ="c:/wamp/tmp"
    xdebug.remote_enable = 1
    xdebug.remote_autostart = 1

Open in new window

I have created a program to make some XML files used to export data from our local system to another system. I used xsd.exe on Visual Studio 2010 to generate C# classes based on XSD schemas that I received from the other system. One of the types of data that are exported are clients. Now, the problem is that the XML files contain too much data. They have this structure (I have replaced some of the data with xx to not leak sensitive client data):
<?xml version="1.0" encoding="utf-8"?>
<ROWSET xmlns:xsi="" xmlns:xsd="" xmlns="Clients">
   <CLIEZIP />

Open in new window

I want to have only the <ROW></ROW> data, not the <BI_CLIENTS>  </BI_CLIENTS> data, so that the data can be imported correctly in the other system. I have attached the code for the generated C# class.
Please help. I am not asking for at complete solution, just for some help to find the right place to change the code.
Software: Visual Studio and SQL Server 2005.
On clickonce deployment I get this error: The aplication requires assembly System.IdentityModel Version be installed in the GAC.

Can someone tell me what is required?


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.