Visual C++.NET

Microsoft Visual C++ (often abbreviated as MSVC or VC++) is an integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages. It features tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework. Many applications require redistributable Visual C++ packages to function correctly and are often installed independently of applications, allowing multiple applications to make use of the package while only having to install it once

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

Sign up to Post

Hi guys,

I have created the following code to read a file from SQL database, copy it to C drive and then upload to SharePoint 2013. The file uploaded if it's less or equal to 300 MB but if it's over is provide the following error.

4/15/2018 2:23:32 PM:    Error Message :: Object reference not set to an instance of an object.Error StackTrace ::    at PP.WindowService.PPSPSync.PMWebSPSync.UploadDocument(String siteURL, String documentListName, String documentListURL, String documentName, Byte[] documentStream, Int64 DocumentTypeId, String ProjectNumber, Int64 DocumentId, Int64 FileContentId, Int64 PhaseID, String FilePath, String LocalFileName) in D:\v24\pp.WindowService.PSPSync\PMWebSPSync.cs:line 466
   at PP.WindowService.PPSPSync.PMWebSPSync.ProcessData(DataRow row) in D:\v24\PP.WindowService.PPSPSync\PPSPSync.cs:line 591


What is the solution?
PPSync2.cs
0
Free Tool: Subnet Calculator
LVL 12
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Dell Optiplex 7020, Windows 7 Pro SP1, 64 Bit

I am unable to install the .NET framework.
Windows had become damaged, so I restored it from a previous image backup.
Everything worked fine after the backup except for the .NET framework.

I have downloaded the 4.7.1  stand-alone, but the installer stops with errors.  Same happened with 4.6.2
I used IOBit Uninstaller (free) and removed all the .NET components that could be found there.
I tried to turn off .NET  3 using the Windows features uninstall, but that gave me errors as well.
Features uninstall error
I ran CCleaner Free, did all the registry repairs.  I ran twice because the .NET issues weren't cleaned up after the first run.

I have included the simple Installation log below
Thanks

OS Version = 6.1.7601, SP = 1.0, Platform 2, Service Pack 1
OS Description = Win7 - x64 Service Pack 1
MSI = 5.0.7601.23593
Windows version = amd64_windowsfoundation_31bf3856ad364e35_6.1.7601.17514_none_615fdfe2a739474c.manifest
Windows servicing = 6.1.7601.23505
CommandLine = C:\63b1d77f74f00749cc94e535\\Setup.exe /x86 /x64 /redist
TimeZone = Eastern Daylight Time
Initial LCID = 1033
Using Simultaneous Download and Install mechanism
Operation: Installing
Package Name = Microsoft .NET Framework 4.7.1 Setup
Package Version = 4.7.02558
User Experience Data Collection Policy: Disabled
Number of applicable items: 11
Exe (C:\63b1d77f74f00749cc94e535\SetupUtility.exe) succeeded.
Exe Log File: dd_SetupUtility.txt
0
Hi Experts,

I've got a DataGridView control that includes some columns that are bound to Double fields in my database.

When I edit any of these cells so that they are empty or blank I get this error:

The following exception occurred in the DataGridView:
System.FormatException: Input string was not in a correct format. —> System.FormatException: Input string was not in a correct format.
at System.Number.ParseDoubleString value, NumberStyles options, NumberFormatlnfo numfmt) at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)
— End of inner exception stack trace — at
System.Windows.Forms.Formatter.lnvokeStringParseMethod( Object value, Type targetType, IFormatProvider formatlnfo) at
System.Windows.Forms.Formatter.ParseObjectlnternal(Object value, Type targetType, Type sourceType, TypeConverter targetConverter, TypeConverter sourceConverter, IFormatProvider formatlnfo, Object formattedNullValue) at System.Windows.Forms.Formatter.ParseObject(Object value, Type targetType, Type sourceType, TypeConverter targetConverter, TypeConverter sourceConverter, IFormatProvider formatlnfo, Object formattedNullValue,
Object dataSourceNullValue) at
System.Windows.Forms.DataGridViewCell.ParseFormattedValu elnternalfType valueType, Object formattedValue, DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter) at
System.Windows.Forms.DataGridViewCell.ParseFormattedValu e(Object formattedValue, 

Open in new window

0
When building code, I am not seeing my changes.  I've changed a simple Text Header on a page and ran the code and it does not change.
I've cleared my cache, restarted, tried a clean build and am at a loss as to what cold be causing this.

We have tested and this is only happening on React JSX pages.  It doesn't look like Webpack is compiling the changes but rather old code.
0
Hi When We are installing Azure Information Protection Client on client machine and after installation when we try to login AIP. it throws below error.

error.JPG
We have tried multiple workarounds like reinstalling, installing sign-in assistant, installing dot net 4.6.2, C++ Runtime libraries. but of no use.

Only thing is it is running on Windows 10 Machine and not on older machines.
0
Hi Experts,

I am trying to debug my vb.net program.

How can I determine what database is being used by a Data Grid View (dgv) control in run time?

My Data Grid View (dgv) control is dgvMaterials.

When my form is loaded and I check the values of dgvMaterials in the Immediate window using ?dgvMaterials, I get this output:

?dgvMaterials
{System.Windows.Forms.DataGridView}
    AccessibilityObject: {ControlAccessibleObject: Owner = System.Windows.Forms.DataGridView}
    AccessibleDefaultActionDescription: Nothing
    AccessibleDescription: Nothing
    AccessibleName: Nothing
    AccessibleRole: Default {-1}
    AdjustedTopLeftHeaderBorderStyle: {DataGridViewAdvancedBorderStyle { All=NotSet, Left=OutsetDouble, Right=Outset, Top=OutsetDouble, Bottom=Outset }}
    AdvancedCellBorderStyle: {DataGridViewAdvancedBorderStyle { All=Single, Left=Single, Right=Single, Top=Single, Bottom=Single }}
    AdvancedColumnHeadersBorderStyle: {DataGridViewAdvancedBorderStyle { All=OutsetPartial, Left=OutsetPartial, Right=OutsetPartial, Top=OutsetPartial, Bottom=OutsetPartial }}
    AdvancedRowHeadersBorderStyle: {DataGridViewAdvancedBorderStyle { All=OutsetPartial, Left=OutsetPartial, Right=OutsetPartial, Top=OutsetPartial, Bottom=OutsetPartial }}
    AllowDrop: False
    AllowUserToAddRows: False
    AllowUserToAddRowsInternal: False
    AllowUserToDeleteRows: False
    AllowUserToDeleteRowsInternal: False
    AllowUserToOrderColumns: False
    AllowUserToResizeColumns: True
  

Open in new window

0
 //-------------------------------------------------------------------------------------------------------------------
   CString m_strConnection = _T("Driver={SQL Server}; Server=DSERVER; Database=OMSDATEN;Uid=;Pwd;");
   CString str_Table=”Customer”;
   LPCSTR Table1 = (LPCSTR)(LPCSTR)str_Table;
   int Sales=0;
   //-------------------------------------------------------------------------------------------------------------------

   _RecordsetPtr rsTipi_1 ("ADODB.Recordset");
    rsTipi_1->Open(Table1, (LPCTSTR) m_strConnection, adOpenForwardOnly,adLockOptimistic, adCmdTable);

   FieldsPtr fldTipi_1 = rsTipi_1->Fields;
   rsTipi_1->Update();

   fldTipi_1->Item["No"]->Value                        =  (LPCSTR) str_No;
   fldTipi_1->Item["Name"]->Value                   =  (LPCSTR) str_Name;
   fldTipi_1->Item["Sales"]->Value                     =  Sales;


   rsTipi_1->Update();
   rsTipi_1->Close();

Open in new window




This works just fine. I can open my sql table Customer and add some new data, but only one row.


But I would like to use an sql query like this:

("SELECT * FROM '%s'  WHERE Order_No='%s'",Table1,(LPCTSTR)str_Order_No)
so I would like to find all rows of my Table “Customer” with Order_No = str_Order_No and change all of these rows with new
data.

I do not know where and how to put the query and change the code?

Please let me know, thank you very much.
Best regards,
Thomas
0
Hello all,

i want to change the backcolor for buttons depends on information from database,
i have form has multiple buttons like this picture bellow.

I have a database table for shops (stores),There is a column in this table that contains the shop number and a column for its status : Yes or No (if rented or empty)

in the model Each shop has a button and this button named as the number of the store number in the database
How can I do for loop to Retrieve store data from the database
and  changes the color of the button depends on the data from the database if it is empty or rented.

thank you,

picture
0
Hello,
can you help me to fix my code.

When I paste the text the result  is not "this is a test"  it is "str_BestellNr", it shows not the content of the string,  just the name of the string.

str_BestellNr="this is a test";

//calling the function
copyToClipboard(str_BestellNr);


//###############################################################################
void CDialogDlg::copyToClipboard(CString str) 
{ 
  
    EmptyClipboard(); 
  
    HGLOBAL hClipboardData; 
    hClipboardData = GlobalAlloc(GMEM_DDESHARE, strlen(str)+1); 
  
    char *pchData; 
    pchData = (char*)GlobalLock(hClipboardData); 
    strcpy(pchData, str); 
  
    GlobalUnlock(hClipboardData); 
  
    SetClipboardData(CF_TEXT, hClipboardData); 
  
    CloseClipboard(); 
} 
  //###############################################################################

Open in new window

Thank you very much for your help.
Best regards,
Thomas
0
Hi Experts,

How do I get the current Windows Region Format, e.g "French (France)" ?

Regards,
Leigh
0
Free Tool: SSL Checker
LVL 12
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hello,

I'm trying to change multiple  panel back color depends on data from database,
the data comes from list called mylist  it have a strings with true and false,
so i need to change the back color of panels depends on that data , so if mylist(1) = true i want the back color is green:
this is what i tried  :

Dim p As List(Of Panel) = Me.Controls.OfType(Of Panel).ToList
        For i As Integer = 1 To duration
            If myList(i) = True Then
                p(i).BackColor = Color.SpringGreen
            End If
        Next

Open in new window


but its not working.
0
Hi EE.

Does anyone know how can I make my app to self delete? In VB.NET I use this:
Process.Start("cmd.exe", "/C ping 1.1.1.1 -n 1 -w 3000 > Nul & Del " + 
          Application.ExecutablePath); 
Application.Exit();

Open in new window

How can I also archive that in C++, I'm using Visual C++ 2010 Windows forms.
0
Hi Experts,

I don't get this error when I run my code on my PC, either inside or outside the IDE.

I have created an installer to run in a clean Windows 7 setup on a Virtual PC.

But when I run the .exe in the Windows 7 setup I get this error:

Object reference not set to an instance of an object

No other information about the error is given.

How can I debug the error (without using lots of tracing information)?
Is there any way of configuring my code to output information about the error?

Regards,
Leigh
0
I  am  totally  confused when should I  use  OnPaint,OnDraw,OnCtlColor,OnEraseBkgnd,RedrawWindow
Will  you  please  explain me.When it  will  cause  flicker  and when it will  not?
What  is returning true or false  from Erase background function?
Can any one  brief me  please tomorrow I  have interview over  it.
0
Hi guys.

I'm using this code to read a text file locally and do the word search as needed but the problem is that the file which this app will be reading will be online on a web server and the problem is that the code I have now to read this text online I don't seem to figure out how I can split data so that I can still do word search just like how I do to a local file. Here is the code I use to read local file:

while(!in.eof() && getline(in, line, ','))
							 {
								if((offset = line.find(ID, 0)) == string::npos)
								{
									id = atoi(line.c_str());
									in >> dat;
									getline(in, NUMBER, ',');
									getline(in, line, '\n');
									
									KEY = (int)atof(line.c_str());
									
									if(ID ==id)
									{
										ID = id;
										//dst = dvs;
										va = KEY;
										
									}

Open in new window


Now this code part is the essential part of code as its what I want to be able to do in the following code which is the code that reads a file from the web.

    #include "stdafx.h"
    using namespace System;
    using namespace System::IO;
    using namespace System::Net;
    using namespace System::Text::RegularExpressions;
    int main(void)
    {
        Regex^ rxSubTitles = gcnew Regex("\\d.*>(?<subtitle>.*)<");
        String^ strFileIn = L"http://textfiles.com/adventure/221baker.txt";
        WebClient^ wc = gcnew WebClient();
        StreamReader^ fileWebIn = gcnew StreamReader(wc->OpenRead(strFileIn));
        String^ strData = "";
        while(!fileWebIn->EndOfStream)
        {
            strData = fileWebIn->ReadLine();
            if(rxSubTitles->IsMatch(strData))
            {
                // take ONLY the subtitle without additional decoration
                Console::WriteLine(rxSubTitles->Match(strData)->Groups["subtitle"]->Value->ToString());
            }
        }
        fileWebIn->Close();
        return 0;
    }

Open in new window

This code simply gets all the Titles.

Here is my text file structure:

111,7643876,2
324,254935,
730,021738248,1

Open in new window


As you can see each line has 3 data fields and
,

Open in new window

is the data separator and as you can also see that the 3rd field can sometimes be empty. I think if you can look at the structure and also look at my first code even though I didn't post the complete code on the first code but I think that s the main part which you may need as its also the main part I'm having problem with when trying to apply it to the second code.
0
Hi.

I have 2 forms Form1 and Form2. Form1 is the core form or the main application first form which runs first then at some point it hide it self and show Form2, the problem now is that I want to also reshow back Form1 when Form2 closes.

Anyone know how I can have that. Currently the forms do hide form1 and show form2 but I can't include form1 on form2 because form1 has already had form2 included in it. I'm using Microsoft Visual Studio 2010 CLI application.
0
I  am  able to create  resource dll,I  am  able to use  icon inside  dll.But how  to use  dialog  inside  resource dll.
Following  way I  loaded dll,declared  id  globally.For  example now IDD_DIALOG1  is there  in  my dll,how  should I
use  it  to display  as  Modal  or  Modeless

     
  HMODULE hmodule = ::LoadLibrary(_T("C:\\Users\\adityaraoa\\Documents\\Visual Studio 
       2012\\Projects\\Win32Project1\\Debug\\Win32Project1.dll"));
	HRSRC hrsr = ::FindResource(hmodule,MAKEINTRESOURCE(IDD_DIALOG1),RT_DIALOG);
	::LoadResource(hmodule,hrsr);// TODO: Add your control notification handler code here
	//HICON hic = ::LoadIcon(hmodule,MAKEINTRESOURCE(IDI_ICON1));
	//btn.SetIcon(hic);

Open in new window

0
Hello,
my code works just fine and I got no error message.
But how can I check the the delete was done? Like a if - else routine

//%%%%%%%%%%%%%%%%%%%%%%%%%% Löschung %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	//SQL Server
	m_strConnection = _T("Driver={SQL Server}; Server=DSERVER; Database=OMSDATEN;Uid=;Pwd;");
		
	 //-----------------------------------------------------------------------------------------------------------
	//Initialize the Recordset and binding pointers
	m_ptrRs = NULL;   
       m_piAdoRecordBinding = NULL;   

	//Initialize the COM environment
	::CoInitialize(NULL);
	try
	{
		//Create the recordset object
		m_ptrRs.CreateInstance(__uuidof(Recordset));  

     
//======================================= Delete ==============================================================
   sql.Format("DELETE LogBuch FROM LogBuch WHERE Zeitstempel>='%s' AND Zeitstempel<='%s'",str_loeschen_von,str_loeschen_bis);
//============================================================================================================
		 
      _bstr_t bstrQuery(sql);
  
		//Open the recordset object Tabelle 
 m_ptrRs->Open(_variant_t(bstrQuery),(LPCTSTR)m_strConnection, adOpenDynamic, adLockOptimistic, adCmdUnknown);

		//Get a pointer to the record-binding interface Coils
		if(FAILED(m_ptrRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))     _com_issue_error(E_NOINTERFACE);
  
		//Bind the record class to the recordset
	//	

Open in new window

0
SQL Server 2000
First I did this:
CString  str_CustomerNo_from="1000"
CString str_CustomerNo_to      ="4000"

sql.Format("SELECT * INTO Sicherung_Thomas.dbo.Customer FROM OMSDaten.dbo.Customer WHERE CustomerNo>='%s' AND CustomerNo<='%s'ORDER BY CustomerNo ASC",str_CustomerNo_from, str_CustomerNo_to);



Then I deleted the data that I saved before:(in OMSDaten database)
sql.Format("DELETE Customer FROM Customer WHERE CustomerNo>='%s' AND CustomerNo<='%s'",str_CustomerNo_from,str_CustomerNo_to);


Now my question: How can I copy the data back from Sicherung_Thomas.dbo.Customer to the existing table OMSDaten.dbo.Customer?
                                             I can not use SELECT * INTO because the table already exist.

Please let me know.
Thank you.
Best regards,
Thomas
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Hello,
I would like to delete a Table from a database.

Name of the Table = "customer"
Name of the Database = "Sicherung_Thomas"
SQL Server 2000

I tried this:

CString str_Tablelle;
str_Tabelle="customer.dbo.Sicherung_Thomas";
 
//-----------------------------------------------------------
sql.Format("DROP TABLE %s ",str_Tabelle);
//-----------------------------------------------------------

My Error Message is: deleting is not possible because table do not exist in  system catalog

But the table is there....what do I did wrong?
Please help.
Best regards,
Thomas
0
I  am  able to  see the  controls  design time  ,but  not able to  see  them  at  run time.
Please  help as  early as  possible.
I  registered FM20.dll  as  suggested  in  one  article  on  google.
Design-Time.png
Runtime.png
0
try
	{
    //...................................................................
	 sql.Format("SELECT * INTO Sicherung_Thomas.dbo.LogBuch_%s FROM OMSDaten.dbo.LogBuch WHERE Zeitstempel>='%s' AND Zeitstempel<='%s'ORDER BY Zeitstempel ASC",str_tmp,str_loeschen_von,str_loeschen_bis);
    //...................................................................
	 _bstr_t bstrQuery(sql);
  	//Open the recordset object Tabelle 
    m_ptrRs->Open(_variant_t(bstrQuery),(LPCTSTR)m_strConnection, adOpenDynamic, adLockOptimistic, adCmdUnknown);
    //Get a pointer to the record-binding interface Coils
	if(FAILED(m_ptrRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))     _com_issue_error(E_NOINTERFACE);
   
	}



	   //---------- Any erros? -------------
    	catch (_com_error &e)
		{
			//Display the error
        	GenerateError(e.Error(), e.Description());
		}
		//-----------------------------------

	


	// Do we have a valid pointer to the record binding?
	if(m_piAdoRecordBinding) m_piAdoRecordBinding->Release();       
	//Set the recordset pointer to NULL
	m_ptrRs = NULL;     
	//Shut down the COM environment
	::CoUninitialize();




//------------------------------------------------------------------------------------------------------------------------------------------------
void  CDatenbank_Anzeigen_Loeschen_Dialog::GenerateError(HRESULT hr, PWSTR pwszDescription)
{
	CString strError;
	//Format and display Error Message
	

Open in new window

0
sql.Format("SELECT * INTO Sicherung_Thomas.dbo.LogBuch4 FROM OMSDaten.dbo.LogBuch WHERE date>='%s' AND date<='%s' ORDER BY Zeitstempel ASC",str_date_von,str_date_bis);

str_date_von  : 2011-01-05         May 1st
str_date_bis:    2011-01-10          Oct.1st

SQL Server 2000

Hallo,
I would like to change the name of the table in Sicherung_Thomas = LogBuch4 to
LogBuch_2011_01_05____2011_01_10 in this sql query
So I want to rename the LogBuch in the query depending on the values in str_date_von,str_date_bis



Thank you for your help.
Best regards,
Thomas
0
Hi Experts,

This is a fragment of my code:

If Not IsDBNull(LayeredSystemComponentsRow.sglShiftFactor) Then '20170704

    .sglShiftFactor = LayeredSystemComponentsRow.sglShiftFactor
	
Else

    .sglShiftFactor = 1.0

End If

Open in new window


When LayeredSystemComponentsRow.sglShiftFactor is DBNull, I get an exception:

System.Data.StrongTypingException was unhandled by user code
  HResult=-2146232021
  Message=The value for column 'sglShiftFactor' in table 'LayerDetails1' is DBNull.
 ...
 ...

 Help!!!!
 
 Regards,
 Leigh
0
Hello all,

I searched my company url https://abc.com and received results.  Is there some way to not have results appear for that search.
Can you please help me asap.

Thank you,
Rithesh
0

Visual C++.NET

Microsoft Visual C++ (often abbreviated as MSVC or VC++) is an integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages. It features tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework. Many applications require redistributable Visual C++ packages to function correctly and are often installed independently of applications, allowing multiple applications to make use of the package while only having to install it once

Top Experts In
Visual C++.NET
<
Monthly
>