![]() |
Very basic question, please
This must be blindingly easy, but I can't figure it. The working example is - frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture However, the 'imgDecca' bit is a variable string. So how do you properly code the equivalent of this - frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture I've tried everything I can think of ! Brackets, CStr... you name it. They all fail. Thanks for any help. Cheers - Kirk |
Very basic question, please
Hi!
frmSerial.imgLabelA.Picture =LoadPicture(imgDecca) imgDecca must be a full fille name string (path and fillename) of the picture. John Ο χρήστης "kirkm" *γγραψε: This must be blindingly easy, but I can't figure it. The working example is - frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture However, the 'imgDecca' bit is a variable string. So how do you properly code the equivalent of this - frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture I've tried everything I can think of ! Brackets, CStr... you name it. They all fail. Thanks for any help. Cheers - Kirk |
Very basic question, please
I don't know what references/objectmodel you are using, but perhaps:
imgDecca is an Object of some kind, then: Dim MyImage as Object ' or whatever is appropriate .. .. .. Set MyImage=imgDecca frmSerial.imgLabelA.Picture = frmLabelIcons.MyImage.Picture You would then vary the Set to pick up the proper picture -- Gary''s Student - gsnu2007k "kirkm" wrote: This must be blindingly easy, but I can't figure it. The working example is - frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture However, the 'imgDecca' bit is a variable string. So how do you properly code the equivalent of this - frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture I've tried everything I can think of ! Brackets, CStr... you name it. They all fail. Thanks for any help. Cheers - Kirk |
Very basic question, please
I think you are looking for this...
frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture -- Rick (MVP - Excel) "kirkm" wrote in message ... This must be blindingly easy, but I can't figure it. The working example is - frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture However, the 'imgDecca' bit is a variable string. So how do you properly code the equivalent of this - frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture I've tried everything I can think of ! Brackets, CStr... you name it. They all fail. Thanks for any help. Cheers - Kirk |
Very basic question, please
On Fri, 12 Sep 2008 09:59:34 -0400, "Rick Rothstein"
wrote: I think you are looking for this... frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture You guys are brilliant, thanks very much. All going wonderfully, and I've learnt a few things. Many thanks - Kirk |
Very basic question, please
I think you are looking for this... frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture Rick, one last request :) What if the required image for frmSerial.imgLabelA.Picture is the default? The one that's embedded in the Form - and shows if the above line is not executed? I've found calling it what it's been changed to, and now is, doesn't really work ROFL... Thanks - Kirk |
Very basic question, please
I think you are looking for this...
frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture Rick, one last request :) What if the required image for frmSerial.imgLabelA.Picture is the default? The one that's embedded in the Form - and shows if the above line is not executed? I've found calling it what it's been changed to, and now is, doesn't really work ROFL... I'm not exactly sure what you mean when you say "calling it what it's been changed to". As for what I think you might be describing, all I can say is it works for me. To recap... I assigned a picture to imgLabelA via the Properties Window, ran the UserForm it is located on and executed the line of code I posted (from a CommandButton on the UserForm)... the pre-assigned picture from the Properties Window was replaced by the picture from imgDecca on the other UserForm. -- Rick (MVP - Excel) |
Very basic question, please
On Fri, 12 Sep 2008 13:07:17 -0400, "Rick Rothstein"
wrote: I'm not exactly sure what you mean when you say "calling it what it's been changed to". As for what I think you might be describing, all I can say is it works for me. To recap... I assigned a picture to imgLabelA via the Properties Window, ran the UserForm it is located on and executed the line of code I posted (from a CommandButton on the UserForm)... the pre-assigned picture from the Properties Window was replaced by the picture from imgDecca on the other UserForm. Hi Rick, Yes indeed, it works the same here too. But my logic is, if the required label image doesn't exist it uses a default one. The way I've coded it, the Form doesn't (have to) close and the last label it loaded remains the active one. I could just copy it again but as it's already there, why not use it? Trouble is, it's just called (Bitmap) in properties and I don't know how to access it (apart from Close/Open the form). Thanks - Kirk |
Very basic question, please
Maybe I still am not following what you are trying to say, but you can
always reference an Image control's Picture property no matter how that picture was loaded... if it was assigned from a file at design time, your code can still get the picture by assigning its Picture property to whatever other Image control you have (this can be done in the Workbook's Open event if you need it before your code runs). -- Rick (MVP - Excel) "kirkm" wrote in message ... On Fri, 12 Sep 2008 13:07:17 -0400, "Rick Rothstein" wrote: I'm not exactly sure what you mean when you say "calling it what it's been changed to". As for what I think you might be describing, all I can say is it works for me. To recap... I assigned a picture to imgLabelA via the Properties Window, ran the UserForm it is located on and executed the line of code I posted (from a CommandButton on the UserForm)... the pre-assigned picture from the Properties Window was replaced by the picture from imgDecca on the other UserForm. Hi Rick, Yes indeed, it works the same here too. But my logic is, if the required label image doesn't exist it uses a default one. The way I've coded it, the Form doesn't (have to) close and the last label it loaded remains the active one. I could just copy it again but as it's already there, why not use it? Trouble is, it's just called (Bitmap) in properties and I don't know how to access it (apart from Close/Open the form). Thanks - Kirk |
All times are GMT +1. The time now is 10:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com