System.Drawing.Bitmap error - vb.net

I have a project with several forms that contain a picturebox (which sometimes contains an image). When I debug my project, I get an error message that says: "System.Drawing.Bitmap". After placing breakpoints in my code, I removed the picturebox from the form. When I go to the next form that contains a picturebox, I get the same error again...
I can't keep deleting all the pictureboxes. I need a solution. Problem is I can't really find any similar problems. I guess there is something wrong with some kind of references of the images or they are not being found...
My project is made for mobile devices / PDA's or Windows CE and written in VB.net.

Are you using the same picture in multiple places? Are the images being disposed or cloned correctly?
If you use the same image multiple times, try calling .Clone (but don't forget to call .Dispose when you are done with the clone)
How are the images being loaded / stored?

Related

Where can I find old .vb form width and height?

I have some old vb.net forms (can't find out which version they were using when they made them), and I can't find the form's Width and Height in any of the files.
The forms don't have a .designer.vb file, and it's not in the .vb "Windows Form Designer generated code" section either. However, when I open the form in the design view, I can see the values perfectly in the Properties tab.
I've tried making a file search for the values independently but there are nowhere to be found.
Any suggestions or ideas?
I have googled for some time but I can't find anything that helps.
After some tests, I'm quite sure the value comes from the sizes of everything else it has inside.
The form has various Group controls that "force" the Form's size, and therefore, there's no need to stablish it manually. If I do so, the values appear as usual, but otherwise, they are not stored anywhere.

AXAcroPDF will not load

I have a PDF COM control on a Windows Forms Application. The process is simple, a file path is sent to a Sub, it checks if the file exists and if so, loads the file on my PDF control and shows the form. The code is simple:
Public Sub LoadPDF(ByVal pathPDF As String)
MessageBox.Show(pathPDF)
If System.IO.File.Exists(pathPDF) Then
frmPDF.dePDF.LoadFile(pathPDF)
frmPDF.Show()
Else
MessageBox.Show("No image available. Please check FEMA and CAMSIS.")
frmPDF.Hide()
End If
End Sub
This code worked 2 hours ago. The same code still works in other applications (that pull the exact same file path). I have compared designer codes/control properties/etc between the current application and the others. I can't find a difference at all. I have tried completely recreating the form and COM control.
Does anyone know why this may be happening?
My solution:
The reference .dll files were corrupt. I used the solution here C# System.AccessViolationException and System.Runtime.InteropServices.SEHException
to fix it. Everything seems to be running fine for now.
Use this instead
axAcroPDF1.src = PDFPath;
To load your PDF into the control instead of LoadFile.

Excel giving "System Error &H80004005 (-2147467259). Unspecified error" message

Everytime I load up my Excel document, it repeatedly shows up with the message from the title. The two options are OK and Help. help opens Office Help which is useless for anything. Clicking OK displays another message saying "Compile error: Out of memory." with OK and Help buttons. Clicking OK brings up VBEditor with no debug line selected and no macro popped up either for that matter. Eventually, after it repeats that and complains 20 (exaggeration) more times (I think that's due to having a lot of duplicate code for ActiveX controls on each sheet). It highlights the first line (the Sub declaration) of the code below.
Private Sub ComboBox4_Change()
Range("B3") = ActiveSheet.ComboBox4.text
End Sub
Now this is dealing with an ActiveX ComboBox. Opening a file from an earlier date will give no errors. It's like after a certain date, it just refuses to work with it. And get this, it's only happening on one computer. The files are saved on a network drive, which shouldn't be causing an error.
I'm almost 100% certain I found a solution to this issue. It may have caused issues for someone else 4 years ago, but it caused issues for me today and I wanted to contribute my answer for anyone else running into the same problem.
I had enabled an "Additional Control" in the Controls Toolbox for Windows Media Player. I think when it loaded in a video file, it overran the memory. This is when I started panicking (company computer and all) and Googling and came across this and a few other articles without a real, fast fix.
The hunch: Once that video file was attempted to be loaded in RAM memory (because that's how Userforms work) it locked up all the memory Excel would allow before throwing all the errors.
What I tried from other posts in various places: I rebooted a few times (before Googling, even). I tried the Quick Repair of Office from Add/Remove programs, that didn't work. (I'm using Office 2016.)
So, what worked? I had the idea that maybe I could disable all ActiveX from loading in my file, and Googled that. I got: https://support.office.com/en-us/article/enable-or-disable-activex-settings-in-office-files-f1303e08-a3f8-41c5-a17e-b0b8898743ed and proceeded to disable all ActiveX controls in Excel. I closed the file out. Can't recall if I closed Excel but I probably did.
Then I loaded up my file. (ActiveX is totally disabled at this time.) No errors! I went to VBA (ALT + F11), opened my UserForm, and the video I had inserted and could not remove was just... gone. I saved the file. I closed the file.
I opened Excel. I re-enabled ActiveX in the Trust Center. I opened my file. Still, no more video on my UserForm (I didn't need it anyway) and no "Unspecified" (memory) errors! And, I can save again!
I hope this solution persists... if not I've got some "splainin' " to do. So far, I'm designing and using the Userform, and saving the file, with no issues whatsoever. I think it worked!
I believe the problem was that I had a user form with an acrobat reader display control (like an iframe, but for PDFs). I didn't have this reference or control on that specific computer and it freaked out. Not 100% sure, but the problem no longer exists.
I have been having a very similar problem with WindowsMediaPlayer (WMP) ActiveX control that I have in a Form. Some computers with office 2016 are giving this error code (usless the help button), this is the first post I have found about something similar with WMP, and I found it after searching for this error on ActiveX controls...
So my solution was to go to VBA (alt+F11), right clic on form that has the activex control and then remove it witohout exporting.
The big problem is, that for me, this form is the most important part of the application.
I have no mor information, if I find something I'll come back to post feedback.
I encountered this issue when trying to pull data from an access database. The query I was trying to pull from in the database was an all value query (*). Once I added the individual fields, the error went away.
I've got this error, when I create a user form which has no body section(just header). (Using this method for the messages where I don't expect a user response. Like a progress bar.
Probably, any abnormality(*)or inconsistency with the user form causes this problem.
Solution: Changed the height of the user form just a few pixel.
Just a simple trick worked for me
Go to Excel Options
Manage Excel Add-ins
Uncheck all and click ok

How to know that Image is successfully loaded in Picturebox from the Internet?

I am using "ImageLocation" property of PictuerBox to get a picture from the web.
PB1.ImageLocation = "http://www.example.com/picture.png"
Some times the image which has to load in picture box from web is very large in size and can not be appear instantly in PictureBox. I need to conform that Image has successfully loaded in Picturebox, before performing next operation.
I have to Enable some controls just after loading of image from web.
Is there any way to conform this?
(Note: My PictureBox has an initial image also.)
Use the PictureBox.LoadCompleted event.
Okay see what I did for mine was just download the picture. The image normally takes a while to start getting put into the picture box.
Here is my code:
If (My.Computer.FileExists("http://www.example.com/picture.png")) Then
My.Computer.Network.DownloadFile("http://www.example.com/picture.png", <Some Location>)
PB1.ImageLocation = <Some location>
Else
End
End If
It may not be the most efficient way - but I can see it as a simple way of making it work.
Dunno if it's working or not, can't access Visual Studio at the moment

Nested UserControls in Windows Phone

I am trying to create a Windows Phone app that will take use a similar UI element in multiple user controls.
One user control is loaded by the main xaml and this user control consists of another user controls. The user controls are all in the same directory below where the main xaml exists.
I get an XamlParseException on the following line in my g.i.cs file for the nested control:
System.Windows.Application.LoadComponent(this, new System.Uri("/MyApp;component/UI/NestedControl.xaml", System.UriKind.Relative));
I think it is doubling the component/UI portions of the path as the parent user control already resides in this directory.
Does anyone know how to solve this?
This exception typically means that the XAML parser cannot find the referenced XAML, or that you have invalid XAML for your NestedControl class.
Without further code, it is hard to determine the root cause. I would suggest deleting these classes until your project compiles, then slowly adding them back again, compiling each time. This will help you identify where the problem lies.