Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image button

Status
Not open for further replies.

lydro

Programmer
Mar 7, 2005
36
CA
I creat a button with image menually, like below

Dim aImageButton As New Button
tpgContact.Controls.Add(aImageButton)
aImageButton.Name = entity
aImageButton.Text = ""
aImageButton.Image = Image.FromFile("C:\vb.net\client\images\checkbox_checked.gif")
aimagebutton.ImageAlign = ContentAlignment.MiddleCenter
aimagebutton.FlatStyle = FlatStyle.Flat
aImageButton.Location = New Point(10, y)
aImageButton.Width = 20
aimagebutton.Height = 20
AddHandler aImageButton.Click, AddressOf ImageButtonclickHandler

the problem I have in here is "aImageButton.Image = Image.FromFile("C:\vb.net\client\images\checkbox_checked.gif")" this line of code. If the app install in other computer, then it won't be able to find the same location. What should I do? Is there any way to change the location to fix the need?
 
Yep.

Add the picture as embedded resource.

---

If you don't know how, ask me to write it down.
 
Add an Imagelist to your form, and add your image into it.
then
Code:
aImageButton.Image = Me.ImageList1.Images(0)


Sweep
...if it works dont mess with it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top