hexagon logo

Form editor: changing image properties with variables

So I'm pretty new to the VB language and even newer to the PC-DMIS form editor. I don't usually have problems with variables in Visual Studio, but with the Form Editor I can't seem to get past the simple declaration of a variable. (For instance, Dim Variable As Integer is no problem, but Variable = [anything I try] somehow causes some kind of syntax error. The editor will not accept it.)

What I'm trying to do is use a variable (or any other method really) to change the property of a Bitmap control to change the image that is displayed. Think of setup instructions with multiple pictures which can be viewed with NEXT/PREVIOUS buttons. Or a probe calibration program that will show the image of the probe configuration depending on which Radio Button is currently selected.

But no matter what I do, I can't seem to change the .bitmap property with the form running. I've tried using EventClick from within the Bitmap control. I've also tried using the Event[something like "ValueChange" but I can't remember] with the Radio Button control. I can get those events to do other things, like show a MsgBox, but the Bitmap control won't show a different image. Can anyone help me out?
Parents
  • What flavour of VB have you learnt?

    I always use the ampersand operator (&Wink for concatenating strings whatever VB I use.

    Also you say it seems strange you have to set the property to the variable again, but that's just the way it is. When you set the property (Bitmap1.Bitmap =strImgPath)...

    Think of the = in that line of code as 'becomes' instead of 'equals'; it's not linked to that variable, it becomes the current value of that variable.

    Which is why the statement...

    i=i+1 (i becomes i +1)

    ...is valid in code but not in maths


    (The clue's in the name, it's a variable, not a constant!)
Reply
  • What flavour of VB have you learnt?

    I always use the ampersand operator (&Wink for concatenating strings whatever VB I use.

    Also you say it seems strange you have to set the property to the variable again, but that's just the way it is. When you set the property (Bitmap1.Bitmap =strImgPath)...

    Think of the = in that line of code as 'becomes' instead of 'equals'; it's not linked to that variable, it becomes the current value of that variable.

    Which is why the statement...

    i=i+1 (i becomes i +1)

    ...is valid in code but not in maths


    (The clue's in the name, it's a variable, not a constant!)
Children
No Data