Solved VB Picturebox control

kuchiyo

New member
Member
VIP
Local time
6:53 PM
Messages
99
Hi, is there way to change the picture box image when pressed a button?

Something like this:

PictureBox1.Image = (Pic.png)

This crashed the application:

PictureBox1.Image = System.Drawing.Bitmap.FromFile(Pic.png)

Thanks.
 

My Computer My Computer

At a glance

Windows 7 Enterprise 64 BitINTEL Core i5-4670K 3,4GHz LGA1150 6MB Cache ...KINGSTON 16GB 1600MHz DDR3 CL10 DIMM (Kit of ...NVIDIA GTX760 2048MB 256BIT D5 DVIx2+HDMI+DP
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Unknown
OS
Windows 7 Enterprise 64 Bit
CPU
INTEL Core i5-4670K 3,4GHz LGA1150 6MB Cache BOX Haswell CPU
Motherboard
ASUS Z87 Socket 1150 Z87-K HDMI DVI RGB 1 x PCIe 3.0/2.0 x16
Memory
KINGSTON 16GB 1600MHz DDR3 CL10 DIMM (Kit of 2) 2x8GB XMP H
Graphics Card(s)
NVIDIA GTX760 2048MB 256BIT D5 DVIx2+HDMI+DP
Sound Card
Realtek® ALC887 8-Channel High Definition Audio CODEC
Hard Drives
WD Desktop Blue 1TB SATA 6Gb/s 64MB Cache
Case
NZXT Tempest 410 - Black
Antivirus
F-secure client security
Browser
Chrome and firefox

My Computer My Computer

At a glance

W10 Pro desktop, W11 laptop, W11 Pro tablet (...3.7Ghz 8700K i7, i7-11800H, i7-1065G716G desktop, 16G laptop, 4G tabletAMD Radeon RX580, RTX 3060, Intel Iris Plus
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Built desktop, Dell G15 5511 Gaming laptop,MS Surface Pro 7 tablet
OS
W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
CPU
3.7Ghz 8700K i7, i7-11800H, i7-1065G7
Motherboard
ASUS TUF Z370-Pro Gaming in desktop
Memory
16G desktop, 16G laptop, 4G tablet
Graphics Card(s)
AMD Radeon RX580, RTX 3060, Intel Iris Plus
Sound Card
High Definition Audio (Built-in to mobo)
Monitor(s) Displays
Samsung U32J59 32" (2x), 15.6", 12"
Screen Resolution
3840x2160, 3840x2160, 1920x1080, 2160x1440
Hard Drives
500G SSD for OS; 2T, 10T & 15T HDDs for Data on Desktop, 1TB SSD laptop, 128G SSD tablet.
PSU
Corsair CX 750M
Case
Antec 100
Cooling
CM 212+
Keyboard
IBM Model M - used continuously since 1986
Mouse
Microsoft Pro IntelliMouse
Internet Speed
400M down 8M up
Antivirus
Windows Defender
Browser
FireFox
Other Info
Built my first computer (8Mhz 8088cpu, 640K RAM, 20MB HDD, 2 360K floppy drives) in 1985 and have been building them for myself, relatives and friends ever since.
Thanks

but
PictureBox1.Image = Image.FromFile _ (System.Environment.GetFolderPath _ (System.Environment.SpecialFolder.Personal) _ & "\Image.gif")

I dont know what to type into this... :huh:

Edit: It works! i used: picturebox1.image = Projectname.My.Resources.Resources.Imagename
 

My Computer My Computer

At a glance

Windows 7 Enterprise 64 BitINTEL Core i5-4670K 3,4GHz LGA1150 6MB Cache ...KINGSTON 16GB 1600MHz DDR3 CL10 DIMM (Kit of ...NVIDIA GTX760 2048MB 256BIT D5 DVIx2+HDMI+DP
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Unknown
OS
Windows 7 Enterprise 64 Bit
CPU
INTEL Core i5-4670K 3,4GHz LGA1150 6MB Cache BOX Haswell CPU
Motherboard
ASUS Z87 Socket 1150 Z87-K HDMI DVI RGB 1 x PCIe 3.0/2.0 x16
Memory
KINGSTON 16GB 1600MHz DDR3 CL10 DIMM (Kit of 2) 2x8GB XMP H
Graphics Card(s)
NVIDIA GTX760 2048MB 256BIT D5 DVIx2+HDMI+DP
Sound Card
Realtek® ALC887 8-Channel High Definition Audio CODEC
Hard Drives
WD Desktop Blue 1TB SATA 6Gb/s 64MB Cache
Case
NZXT Tempest 410 - Black
Antivirus
F-secure client security
Browser
Chrome and firefox
Back
Top