Picture show in image1

  • Thread starter Thread starter Ivica Lopar
  • Start date Start date
I

Ivica Lopar

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
 
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
 
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.
 
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
 
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
 
Actually, your post wasn't visible when I posted. We just happen to
recommend the same solution.
 
Is it posiblle if path in list it is not good that Image1 is empty(no
picture)
Is it posiblle that code add al pictures path in list1 if beginn with
string in texBox 2
lop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top