Target CPU

Hello,

Changing Target CPU from X86 to x64 makes the designer have lot of errors. I am using visual studio 2017.
any suggestions?
RIASAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Can you let us know what the errors say because that should not happen.  
Are you using third party components - maybe they are only in the 32 bit version or you have not changed the reference to the 64 bit dll they are in.
0
AndyAinscowFreelance programmer / ConsultantCommented:
Just in case - close and restart Visual studio and consider a reboot.  It is amazing how often that can cure a problem.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MishaProgrammerCommented:
What errros, for example?
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

RIASAuthor Commented:
Please refer this link for error:
https://www.earthli.com/news/view_article.php?id=2487
0
RIASAuthor Commented:
Andy,
Trying closing., rebuild .clean everything.
No luck
0
AndyAinscowFreelance programmer / ConsultantCommented:
Can you please post YOUR errors.
0
sarabandeCommented:
what kind of project did you want to change from target X86 to X64? and why?

did the project build after doing so?

Sara
0
RIASAuthor Commented:
There is a requirement  to export bitmap to powerpoint. Thats the reason I am changing the target to X64 or else I get memory out of exception.
Yes, I do build but the same
0
AndyAinscowFreelance programmer / ConsultantCommented:
How big is the bitmap?  (Have I already asked you that in the other question?)

Please post the errors you get in the designer.  Just posting a link to an article is not much use.
0
RIASAuthor Commented:
Ok Andy
0
RIASAuthor Commented:
The bitmap is quite large. When I changed to X64 it worked. it was a solution givenby MSDN.
Andy, Now since I reopened the project it lookslike the error has disapperared. It prompted me to save the form     , I did and it looks ok.
Thanks for your help.
sarabande thanks for you help as well.

Thanks
0
sarabandeCommented:
you may consider to compress the bitmap to a smaller size, say by converting it to .png or .jpg.

usually, power point doesn't need a very detailed resolution of input pictures as the output to the screen or to slides will do compressing anyhow. you should try to which extent you can compress the images without loss.

note, memory issues with your method not necessarily may vanish by using a 64-bit target platform. if the target computer is short on contiguous memory space while loading the huge picture, it may fail as well.

Sara
0
RIASAuthor Commented:
Thanks Sara,
can you give an example on how to compress bitmap
0
RIASAuthor Commented:
 Dim picture As Bitmap


        Dim ppSlide As PowerPoint.Slide = Nothing
        Dim objShape As PowerPoint.Shape = Nothing
        '  Dim oldbitmap As Bitmap = Nothing
        Dim Strname As String = String.Empty
        Dim strTemplateFile As String = String.Empty
        Dim dtnew As New DataTable

        Dim NumberOFPictures, Slidenumber As Integer
        Dim TempStr = System.IO.Path.GetDirectoryName(
    System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
        TempStr = (New Uri(TempStr).LocalPath)
        Dim pathToSavedImage As String = TempStr & "\TempPhoto\TempPhoto.png"
        Dim strImg As String = String.Empty
        strImg = TempStr & "\TempPhoto\TempPhoto.png"

Open in new window



 Dim pictureData As Byte() = dtnew.Rows(i).Item(3)
                            'Create a stream in memory containing the bytes that comprise the image.
                            Using stream As New IO.MemoryStream(pictureData)
                                'Read the stream and create an Image object from the data.
                                Try
                                    Application.DoEvents()
                                    Do
                                        picture = Bitmap.FromStream(stream)
                                        If IsNothing(picture) = False Then Exit Do
                                    Loop


                                    ' Thread.CurrentThread.Sleep(400)
                                    Application.DoEvents()

                                Catch ex As Exception
                                    Do
                                        If IsNothing(picture) = False Then
                                            Exit Do
                                        Else
                                            Application.DoEvents()
                                        End If
                                    Loop

                                End Try


                            End Using

Open in new window

0
RIASAuthor Commented:
i am already converting it to .png
0
sarabandeCommented:
if you want to compress the bitmap in your program using Image.Save, you may have the same memory issues because you firstly have to load the whole bitmap into memory.

if the bitmap is in a file you better would use a commandline tool to convert it from bitmap to png (or jpg). tools like imagemagick, easy2convert, ....

or open it with mspaint and store it with jpg or png extension.

Sara
0
AndyAinscowFreelance programmer / ConsultantCommented:
I'm not absolutely convinced that is your problem unless your image really is huge.  I don't know how many GB of RAM your system has but even a 20MB image is small compared to the memory one has these days.  

(You might have other problems with how your code is structured and how the GC mechanism works.)
0
RIASAuthor Commented:
Andy,
I have posted the code.
Please let me know.
0
sarabandeCommented:
i am already converting it to .png

in the code you posted is no Save statement.

did you free the Bitmap after saving it as png file?

the following link shows sample code for to save bitmaps:

https://msdn.microsoft.com/en-us/library/ytz20d80(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

Sara
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>I have posted the code.

Actually you have only posted (probably) a small part of your apps code.  Microsoft says that objects no longer referred to will be garbage collected and memory released when memory is running short.  Unfortunately that is not quite true - and working with images is one of the areas where that inaccuracy can (not does - most times it is not a problem) have nasty consequences.
0
RIASAuthor Commented:
Sara, Amazing will try this and brb
0
RIASAuthor Commented:
Thanks Andy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.