Is it If - Else problem?

Run-time error '481':

Invaild picture

How to solve this? If i want to have a error dialog box and i need to display pictures only not text and .doc files, i not sure of how to use the if-else code.Below is the coding:

Private Sub cmdDisplay_Click()

MainFrm.picFloorplan.Picture = LoadPicture(MainFrm.txtfilename.Text) 'Load the Floorplan picture into the picture box in MainFrm

MainFrm.ScalingRatioTxt.Text = HeightFloorplan.Text

FloorPlanFrm.Visible = False


End Sub

Comments

  • [b][red]This message was edited by doofusboy at 2005-8-17 3:22:28[/red][/b][hr]
    [b][red]This message was edited by doofusboy at 2005-8-17 3:21:47[/red][/b][hr]
    : Run-time error '481':
    :
    : Invaild picture
    :
    : How to solve this? If i want to have a error dialog box and i need to display pictures only not text and .doc files, i not sure of how to use the if-else code.Below is the coding:
    :
    : Private Sub cmdDisplay_Click()
    :
    : MainFrm.picFloorplan.Picture = LoadPicture(MainFrm.txtfilename.Text) 'Load the Floorplan picture into the picture box in MainFrm
    :
    : MainFrm.ScalingRatioTxt.Text = HeightFloorplan.Text
    :
    : FloorPlanFrm.Visible = False
    :
    :
    : End Sub
    :



    Uhhhhh, it would appear you are passing Text to a function that is looking for a Picture file [like .bmp, .gif, .jpg].

    Load[b]Picture[/b](MainFrm.txtfilename.[b]Text[/b])

    Try passing it the path to the picture file:

    LoadPicture("C:directory_with_pic_file" & MainFrm.txtfilename.Text & """)......where MainFrm.txtfilename.Text is the name of a [b]PICTURE[/b] file like my_new_car.jpg.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion