Results 1 to 12 of 12
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Form (VB6)

    With the following code from my form, I get type mismatch error:
    It is a form I am converting from Access to VB.
    All controls have been reproduced to the same control names.
    The text txtEst, I have changed to number format in properties.

    <pre>Private Sub FillImages(intIndex As Integer)

    Dim I As Integer

    If intIndex > intFileCount - intNumberOfImages + 1 Then
    intIndex = intFileCount - intNumberOfImages + 1
    End If
    If intIndex < 1 Then
    intIndex = 1
    End If
    For I = 1 To intNumberOfImages


    'This line below "Type Mismatch Error 13"
    Me.Controls("img" & I).Picture = strFolder & "" & arrFileNames(I + intIndex - 1)


    Next
    Me.txtInfo = "Images " & intIndex & " to " & (intIndex + intNumberOfImages - 1) & " of " & intFileCount
    intCurIndex = intIndex
    Me.cmdFirst.Enabled = (intIndex > 1)

    End Sub</pre>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image Form (VB6)

    Try Me.txtInfo.Text = ...
    Text boxes are treated slightly differently in VB6 compared with Access; you must refer to their Text property explicitly.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    Hans
    Thanks for the prompt reply, txtInfo seems to work ok with or without .text explicit reference.
    The line causing the problem is:

    Me.Controls("img" & I).Picture = strFolder & "" & arrFileNames(I + intIndex - 1)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image Form (VB6)

    I don't have VB6 available at the moment, if nobody else reacts, I'll look at it tomorrow.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    No worries.
    Thanks for looking at it.

    p.s

    As you probably can see, I dabbling once more <img src=/S/groan.gif border=0 alt=groan width=16 height=15> but am learning by the day.
    Managed to pull the PDF one off very well, and hoped to integrate the image protion of my Access DB along with it.
    Have a good evening.

  6. #6
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    This edit to the line seems to have helped, but the images load to their original size instead of within the Img controls form size:

    Me.Controls("img" & I).Picture = LoadPicture(strFolder & "" & arrFileNames(I + intIndex - 1))

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Image Form (VB6)

    Check the setting for the Stretch property of the control. It has to be True for the graphic to resize itself to the control.
    Charlotte

  8. #8
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    Thanks Charlotte, that did the trick.
    (Takes some getting used to these properties in VB)

    There are also properties which I wished to use ie, BorderColor & BorderWidth, they are not present in Vb, is there an alternative ?

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image Form (VB6)

    No, in VB6 you're limited to Appearance (3D or Flat) and BorderStyle (Fixed Single or None).

  10. #10
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    Thanks Hans
    I can't believe a program with such capabilities doesn't contain such controls as Access.
    Perhaps I am too comfortable in Access

    Have a good day .

  11. #11
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Image Form (VB6)

    The closest you could come would be to put the control in a frame and play with the frame's size and backcolor property. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  12. #12
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image Form (VB6)

    Thanks again Charlotte.

    I've managed to work around this by giving a different visual effect.
    I created two functions for Click & DblClick to extend the Image to Form.Width & Form.Height proportions.
    This in its self also gives me a simple zoom also.

    DblClick Resizes the control (Zoom) & Click reset's its size and position back to where it started.
    I'm just messing with Screenwidth and ScreenHeight properties to combat different resolution settings.
    Hopefully I can build a start object module to combat this.
    I think something like:

    Sub main()
    If (800 * Screen.TwipsPerPixelX) = Screen.Width And (600 * Screen.TwipsPerPixelY) = Screen.Height Then Form800.Show
    If (1024 * Screen.TwipsPerPixelX) = Screen.Width And (768 * Screen.TwipsPerPixelY) = Screen.Height Then Form1024.Show
    End Sub

    Should do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •