ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Picture show in image1 (https://www.excelbanter.com/excel-programming/345493-picture-show-image1.html)

Ivica Lopar

Picture show in image1
 
I wont to have view of picture in image1 when I add path of picture in
list1, but nothing is hapening.
Can I get some help please.
Regards
Lopar



Private Sub CommandButton1_Click()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim ImgPath



a = TextBox3.Text
b = TextBox2.Text
c = TextBox4.Text
d = TextBox5.Text
e = TextBox6.Text
list1.AddItem a & c & d & b & e
List2.AddItem c & d & b & e

If list1.ListIndex = -1 Then Exit Sub
ImgPath = list1.List(list1.ListIndex)
Image1.Picture = StdFunctions.LoadPicture(ImgPath)




TextBox2.Text = ""

TextBox2.SetFocus




End Sub



Leith Ross[_275_]

Picture show in image1
 

Hello Ivica Lopar,

Try this...


Code:
--------------------
Private Sub CommandButton1_Click()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim ImgPath


a = TextBox3.Text
b = TextBox2.Text
c = TextBox4.Text
d = TextBox5.Text
e = TextBox6.Text
list1.AddItem a & c & d & b & e
List2.AddItem c & d & b & e

'Get the last Image Path added to List1
ImgPath = list1.List(list1.Count - 1)
Image1.Picture = StdFunctions.LoadPicture(ImgPath)


TextBox2.Text = ""

TextBox2.SetFocus


End Sub

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484703


Tom Ogilvy

Picture show in image1
 
Private Sub CommandButton1_Click()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim ImgPath



a = TextBox3.Text
b = TextBox2.Text
c = TextBox4.Text
d = TextBox5.Text
e = TextBox6.Text
list1.AddItem a & c & d & b & e
List2.AddItem c & d & b & e


ImgPath = list1.List(list1.ListCount - 1)
Image1.Picture = StdFunctions.LoadPicture(ImgPath)




TextBox2.Text = ""

TextBox2.SetFocus




End Sub

This assumes your path is properly created by concatenating textboxes.

--
Regards,
Tom Ogilvy


"Ivica Lopar" wrote in message
...
I wont to have view of picture in image1 when I add path of picture in
list1, but nothing is hapening.
Can I get some help please.
Regards
Lopar



Private Sub CommandButton1_Click()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim ImgPath



a = TextBox3.Text
b = TextBox2.Text
c = TextBox4.Text
d = TextBox5.Text
e = TextBox6.Text
list1.AddItem a & c & d & b & e
List2.AddItem c & d & b & e

If list1.ListIndex = -1 Then Exit Sub
ImgPath = list1.List(list1.ListIndex)
Image1.Picture = StdFunctions.LoadPicture(ImgPath)




TextBox2.Text = ""

TextBox2.SetFocus




End Sub





Ivica Lopar

Picture show in image1
 


doesnt work
ImgPath = list1.List(list1.Count - 1)
**** doesnt recognize


*** Sent via Developersdex http://www.developersdex.com ***

Ivica Lopar

Picture show in image1
 
It is working
Thank You so much
Where can I get good Book For Vb for excel
or where can I get few excamples

lop

*** Sent via Developersdex http://www.developersdex.com ***

Leith Ross[_276_]

Picture show in image1
 

Hello Lopar,

If List1 is a ListBox control, the property .ListCount is valid. I
apologize for the typing error that Tom caught. Second, make sure the
ImagePath is fully qualified.

IMAGE PATH EXAMPLE:
imgPath = "C:\My Documents\Picture\img001.jpg"

If your image path is not like the example, it will not load the Image
control.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484703


Tom Ogilvy

Picture show in image1
 
Actually, your post wasn't visible when I posted. We just happen to
recommend the same solution.

--
Regards,
Tom Ogilvy

"Leith Ross" wrote
in message ...

Hello Lopar,

If List1 is a ListBox control, the property .ListCount is valid. I
apologize for the typing error that Tom caught. Second, make sure the
ImagePath is fully qualified.

IMAGE PATH EXAMPLE:
imgPath = "C:\My Documents\Picture\img001.jpg"

If your image path is not like the example, it will not load the Image
control.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484703





All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com