Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Need Assistance on OLEDragDrop and Drag methods

Need Assistance on OLEDragDrop and Drag methods

Scheduled Pinned Locked Moved Visual Basic
databasedesigngame-devquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ymilan
    wrote on last edited by
    #1

    I have a solitaire game where I have 52 cards lined up in design view.   I'm wondering (in design view) what to set the oledragmode, oledropmode, and dragmode elements to; automatic?   manual? What's happening with my code below is that I only want 12 hearts cards to be dragged to blank card positions on the right of the screen.   However, all the cards drag and all cards, including hearts cards can only drop onto the 13th blank card on the right.   Not the 0 to 12. Should I write some code to set or clear the dragmodes and what do I do in design mode? I only want the first 12 cards of the 52 cards to be dragged; they are hearts cards and I want 12 blank cards on the right to be the hearts suit only.   Pardon me; I'm new to this;   Also Much appreciation in advance. Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) Dim HeartsIndex As Integer    Image(0).Picture = Hearts(0).Picture Image(1).Picture = Hearts(1).Picture Image(2).Picture = Hearts(2).Picture Image(3).Picture = Hearts(3).Picture Image(4).Picture = Hearts(4).Picture Image(5).Picture = Hearts(5).Picture Image(6).Picture = Hearts(6).Picture Image(7).Picture = Hearts(7).Picture Image(8).Picture = Hearts(8).Picture Image(9).Picture = Hearts(9).Picture Image(10).Picture = Hearts(10).Picture Image(11).Picture = Hearts(11).Picture Image(12).Picture = Hearts(12).Picture       For Index = 0 To 12    For HeartsIndex = 0 To 12             If Image1(Index).Picture = Hearts(HeartsIndex).Picture Then             Hearts(HeartsIndex).Picture = Source(HeartsIndex).Picture             Image1(Index).Drag vbEndDrag             MsgBox ("You're right")             Exit Sub             Else             Image1(Index).Drag vbCancel             MsgBox ("You're Wrong")             Exit Sub             End If       Next HeartsIndex Next Index End Sub

    K 1 Reply Last reply
    0
    • Y ymilan

      I have a solitaire game where I have 52 cards lined up in design view.   I'm wondering (in design view) what to set the oledragmode, oledropmode, and dragmode elements to; automatic?   manual? What's happening with my code below is that I only want 12 hearts cards to be dragged to blank card positions on the right of the screen.   However, all the cards drag and all cards, including hearts cards can only drop onto the 13th blank card on the right.   Not the 0 to 12. Should I write some code to set or clear the dragmodes and what do I do in design mode? I only want the first 12 cards of the 52 cards to be dragged; they are hearts cards and I want 12 blank cards on the right to be the hearts suit only.   Pardon me; I'm new to this;   Also Much appreciation in advance. Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) Dim HeartsIndex As Integer    Image(0).Picture = Hearts(0).Picture Image(1).Picture = Hearts(1).Picture Image(2).Picture = Hearts(2).Picture Image(3).Picture = Hearts(3).Picture Image(4).Picture = Hearts(4).Picture Image(5).Picture = Hearts(5).Picture Image(6).Picture = Hearts(6).Picture Image(7).Picture = Hearts(7).Picture Image(8).Picture = Hearts(8).Picture Image(9).Picture = Hearts(9).Picture Image(10).Picture = Hearts(10).Picture Image(11).Picture = Hearts(11).Picture Image(12).Picture = Hearts(12).Picture       For Index = 0 To 12    For HeartsIndex = 0 To 12             If Image1(Index).Picture = Hearts(HeartsIndex).Picture Then             Hearts(HeartsIndex).Picture = Source(HeartsIndex).Picture             Image1(Index).Drag vbEndDrag             MsgBox ("You're right")             Exit Sub             Else             Image1(Index).Drag vbCancel             MsgBox ("You're Wrong")             Exit Sub             End If       Next HeartsIndex Next Index End Sub

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      I don't think there is a standard about whether or not you set a property at design time or if you do it in code. It's up to you. Sounds like you just need to play with the properties until you find what you are looking for. You need to make sure the properties are initially set when loading the form, which can be done either in the load event or set at design time. Then think about when these properties need to change during run time and code the proper events. Is this what you were asking?

      Y 1 Reply Last reply
      0
      • K Kschuler

        I don't think there is a standard about whether or not you set a property at design time or if you do it in code. It's up to you. Sounds like you just need to play with the properties until you find what you are looking for. You need to make sure the properties are initially set when loading the form, which can be done either in the load event or set at design time. Then think about when these properties need to change during run time and code the proper events. Is this what you were asking?

        Y Offline
        Y Offline
        ymilan
        wrote on last edited by
        #3

        Yes, and thank you.   However, I need to gather more info.   I'm still a bit confused.   I know I'd like to set the properties at design time and set them to remain that way throughout the entire program. Here it is:   52 cards on left; 12 of which I ONLY want to match 12 cards on the right when dropped.   52 cards get randomized, and I pick out one by one those 12 cards and drop it on a spot on the right.   It works.   Now here is what is wrong:   ALL the cards, including those 12 cards drop on the right; I was only allowing in my code in the IF statement that when one of the 12 cards of the heart suit on the left = the heart suit on the right, only those cards can be dropped, not every card of the other suits. Second problem.   Only the last position Hearts(12) on the right is taking cards.   The rest of the 12 position won't take any cards. Any idea on WHAT to set on those drag mode properties at design time?   I've played around and have gotten nowhere. Thank you in advance

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups