PictureBox Missed In the .exe VB.net - vb.net

I have A pictureBox in a form
I have declared a Picture box called Then
Field.Image = Image.FromFile("C:\Users\ABK\Desktop\Othello\field.png")
Field.Size = New System.Drawing.Size(483, 610)
Then I added the picbox to the form but when i copy the exr into another computer I don't see the picture
when I copy the exe into another computer I cannot see the picture
how can I include it in the exe file
Please try to keep the answers as simple as possible and demonstrate with examples

click on your form.
the properties tab should be on the bottom right
find image or background image and click on it
click the ... on the right side.
image as example of instructions above
a menu should show up.
Click import then select the file you want saved,
then press open it should go back to the menu,
select (none) to set your form image back to normal,
image as example of instructions above
then press ok,
go back to your code and change
Field.Image = Image.FromFile("C:\Users\ABK\Desktop\Othello\field.png")
to Field.Image = My.Resources.field
This should keep the image when you give it to your friend

Related

Access 2016 linked picture path lost after closing and reopening the database

1 main form, containing 2 subforms:
first subform, datasheet view: list of employees; second subform, single form view: contact details and photo.
frmContactDetails has a image (inserted using design>controls>image), which contolsource is linked to the employee photo path.
frmEmployee, On Current event: requery frmContactDetails.
I linked a blank photo in image.picture property.
Everything works well, I can select any employee and see all détails and photo updating according to the current record. I can do a compact and repair, reopen the main form, and it is still working.
Problem: When I close and reopen the database, photos are not updating anymore. In design view, image.picture property still shows the complete blank photo path in the field, but when I clic to the 3 dots button, it does not reach the folder conatining this photo. I need to set again the correct path, save and reopen the form to make it work again.
I've been trying to find a solution for hours without success.
frmEmployee record source:
SELECT tblEmployee.Email, tblEmployee.EmployeeName FROM tblEmployee;
frmEmployee OnCurrent event:
Private Sub Form_Current()
Me.Parent.txtEmployeeEmail.Value = Me.Email
Me.Parent.frmContactDetail.Requery
End Sub
frmContactDetails record source:
SELECT tblPhotos.Email, tblPhotos.PhotoName
FROM tblPhotos
WHERE (((tblPhotos.Email)=[Forms]![frmMain]![txtEmployeeEmail]));
frmContactDetails image: control source: PhotoName, picture type: Linked, Size Mode: clip, Picture property:
C:\Users\UserName\Desktop\test\BlankImage.bmp
Do you have an idea on what could be wrong?
Additional information:
All pictures are in .png format (except the BlankImage.bmp). I found a piece of code to load .png images in my custom ribbon and it works well. Pictures are stored in a subfolder of temp folder. I think this piece of code uses API and it is too complex for me to understand: I tried to use the same function to load images into the form without success. In tblEmployee, there is an attachment with .png photo. At first, I tried to link the Image control to this attachment, but it does not display photos. Then I copied images Inside a folder of the temp folder, and used the .Picture property to display photo Inside the image control. I added a Field to tbl Employee with PhotoName. A textbox in the form is linked to this field, and then I recreate the full path using Environ("temp")\photofolder[PhotoName].png. If there is no path in .Picture (in design view) it is set to (none) and image control do not refresh. I give the path to BlankPhoto in design view, and then all updates correctly when I use the form. The problem is if I close Access and re-open it, BlankPhoto path is still visible in .Picture but when I click on the three dots button the file picker starts in Document folder (the path is lost), and photos do not update correctly.
What would be the correct way to go?

workbook.save doesn't work properly

I'm writing a code to save the changes made to excel file using the button click option.
The code for that is very simple:
workbook.Save()
workbook.Close()
App.close() - this is to close the Excel.Application
However, when I click the button I need to wait a bit and this image appears
I would show the image but due to not having 10 reputation it doesn't let me, so I will explain.
The image form has the title File Now Available and below that in the description it said " 'test4.xlsx is not available for editing. Choose Read-Write to open it for editing "
When I click the cross top right of image the excel file opens and then I have to close that. Once done then I can read that file again.
Is there a way I can write a code whereby that image message doesn't appear and it closes the file properly, as I believe this code doesn't fully close it.
Any help is appreciated
Thank You

Select Image File and Display it in Forms (Visual Basic)

I have a form, in which it has a few pictureBoxes that i intended to use as a normal button.
first button is the select file button where when the users click the button, a window will pop up allowing the users to select files to be analyzed.
the second button is a run button where when the users have selected the desired files, clicking this will run the application to analyze the image file.
third button is a stop button to stop the analyzing process.
last button is a help button that provide the help and support.
the question is that how do i display the selected files on the form in a tabular format with basic information like file name, file type, date created and date modified?
You can use a listview control with the .View property set to Details. Add an item and subitems for each file.

Modifications to VB.NET PDF Viewer

Okay, I know a question LIKE this has been asked before, but none of them covered this certain toolbar. After the top and left toolbars are hidden, this little black window shows up near the bottom of the screen which allows the user to print, save, zoom, etc. They can also even open the top and left toolbars back up by clicking the Adobe logo.
As you can see, at the top of my program I have a toolbar of my own. The way my program works is a user will input data, press the 'Create Report' button and this Report Viewer window will popup. When the user Creates a Report a .PDF file named preview.pdf is created and that's what the user opens up. If the user doesn't like the report he can hit the X to delete it, or if he likes it he can type a File Name and Press Save. Or he can skip the saving and just print it. When the user saves the file it goes to a place that the software can retrieve at a later time. If the user presses the save button on one of the Adobe toolbars he has the option to save it where they want to. I can't have that.
Does anybody know how to disable ALL Adobe toolbars in the .NET PDF Viewer? (And yes, I know that Pressing F8 will bring them back up).
Here's the code I have now:
pdf.src = "C:\Users\Ryan\Desktop\HelloWorld.pdf"
pdf.setShowToolbar(False)
pdf.setView("fitH")
pdf.setLayoutMode("SinglePage")
pdf.setShowScrollbars(False)
pdf.setZoom(68)
Here's a screenshot of the Windows Form:
Acrobat viewer has such switchable options.
this configuration switchs off all navigation:
view=FitH
scrollbar = 0
toolbar= 0
statusbar= 0
messages= 0
navpanes= 0

Displaying image in a VB form Picture Box at runtime

I am designing an app and I want to attach some pictures to my VB forms. I have used a picture box and the image is only visible before I debug. Once debugging starts, the image disappears.
How do I display the image when I run the debugger? This is the code I used for the picture box:
PictureBox1.Image = My.Resources.tropical_island3
I ran into a similar problem on a VB.NET form. I found when loading the form as a modal window (.ShowDialog) the image in the picture box showed fine, but if loading the form as non-modal (.Show) the PictureBox showed with a white background.
To resolve showing the image in the non-modal form, I needed to call .Refresh for the form after the .Show
Hope that helps someone else!
This is a possibility, based on the limited info:
If the image is shown in the picturebox before you run the form in debug mode, then it apparently has been assigned at design time to the PictureBox1.Image property. When you run the program and assign My.Resources.tropical_island3 to the Picture Box image, it clears the image because My.Resources on your home computer does not have tropical_island3 like the one at class, or maybe tropical_island3 is spelled incorrectly.