Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i convert VB code to C++ code??
How can i convert the code??

this is my VB code.
VB
Dim OpenFileDialog1 As New OpenFileDialog

        With OpenFileDialog1
            .CheckFileExists = True
            .ShowReadOnly = False
            .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
            .FilterIndex = 2
            If .ShowDialog = DialogResult.OK Then
                ' Load the specified file into a PictureBox control.
                PictureBox1.Image = Image.FromFile(.FileName)
            End If
        End With
Posted
Updated 20-Apr-10 21:36pm
v2

The example you were given was C++/CLI. Standard C++ will be totally different, but still trivial.
 
Share this answer
 
Yes you can.
And it won't be difficult.
:)
 
Share this answer
 
Simple example :)
FileStream* OpenFile()
   {
       // Displays an OpenFileDialog and shows the read/only files.

       OpenFileDialog* dlgOpenFile = new OpenFileDialog();
       dlgOpenFile->ShowReadOnly = true;

       if (dlgOpenFile->ShowDialog() == DialogResult::OK) {
           // If ReadOnlyChecked is true, uses the OpenFile method to
           // open the file with read/only access.
           if (dlgOpenFile->ReadOnlyChecked == true) {
               return dynamic_cast<FileStream*>(dlgOpenFile->OpenFile());
           }

           // Otherwise, opens the file with read/write access.
           else {
               String* path = dlgOpenFile->FileName;
               return new FileStream(path, System::IO::FileMode::Open,
                   System::IO::FileAccess::ReadWrite);
           }
       }
       return 0;
   }
 
Share this answer
 
All it takes is an understanding of C++.

Then spend some time doing it.

Perhaps you would like to spend money?

No?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900