Code For Loading a pic into a picture box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zaccy
    New Member
    • Jul 2007
    • 11

    Code For Loading a pic into a picture box

    im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
  • rd301
    New Member
    • Jun 2007
    • 7

    #2
    Originally posted by Zaccy
    im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
    hello

    kindly tell which language u r using for pragramming.

    RD

    Comment

    • vagaisuresh
      New Member
      • Jun 2007
      • 17

      #3
      Originally posted by Zaccy
      im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
      Example from my project. I get this code from online friends.

      [HTML]
      Private Sub HidePicture()

      Dim MyCondition As Integer

      If cmbShape = "Angle" Then
      MyCondition = 1
      ElseIf cmbShape = "Circle" Then
      MyCondition = 2
      ElseIf cmbShape = "Circular Tube" Then
      MyCondition = 3
      ElseIf cmbShape = "Hexagon (A/F)" Then
      MyCondition = 4
      ElseIf cmbShape = "Hexagon (A/C)" Then
      MyCondition = 5
      ElseIf cmbShape = "Hollow Rectangle" Then
      MyCondition = 6
      ElseIf cmbShape = "I-Beam" Then
      MyCondition = 7
      ElseIf cmbShape = "Octagon (A/F)" Then
      MyCondition = 8
      ElseIf cmbShape = "Octagon (A/C)" Then
      MyCondition = 9
      ElseIf cmbShape = "Rectangle" Then
      MyCondition = 10
      ElseIf cmbShape = "Square" Then
      MyCondition = 11
      ElseIf cmbShape = "Tee Section" Then
      MyCondition = 12
      ElseIf cmbShape = "U-Channel" Then
      MyCondition = 13
      Else
      End If

      Show_PBox MyCondition

      End Sub

      Sub Show_PBox(Index As Integer)

      ' Hide all pictureboxes
      Dim i As Integer
      For i = 0 To 12
      picShape(i).Vis ible = False
      Next i

      ' Show the requested picturebox
      picShape(Index - 1).Visible = True

      End Sub
      [/HTML]

      Comment

      • Zaccy
        New Member
        • Jul 2007
        • 11

        #4
        i am using visual basic
        the newest one
        and i need the coide to load a file from like a folder in my computer code in the old visual basic 6.0 it is like ::


        Randomize
        Select Case Int(Rnd * 6)+1

        Case 1
        picboxname.pict ure = LoadPicture(app .path & \picname.bmp)

        and so on
        but i need the code for the new version as this dont work
        thanx heaps

        Comment

        Working...