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. Swap values of two textboxes using drag and drop

Swap values of two textboxes using drag and drop

Scheduled Pinned Locked Moved Visual Basic
questioncsharpvisual-studiodata-structures
1 Posts 1 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.
  • E Offline
    E Offline
    Ed Suyer
    wrote on last edited by
    #1

    I'm very new to .net .... any help is much appreciated! I'm using vb.net and visual studio.net to build a form. This form has two textboxes (textbox1 and textbox2). I'm trying to drag and drop the value of textbox2 into textbox1. Further, after the drop, I went textbox2 to retain the value of textbox1. A swap. See illustration below: Figure 1 - The initial state of both textboxes Textbox1 Textbox2 15          37 Figure 2 - The state of the textboxes after the drag and drop Textbox1 Textbox2 37 <----- 15 So far, I've gotten this to work: Textbox1 Textbox2 37 <----- 0 I've debugged what I've done so far, and checked the call stack. What's happing so far is: 1. The mousedown event occurs on textbox2. This even triggers the drag and drop event of textbox1 2. In the textbox1.drag_and_drop(), I've added some code to set textbox1.text = 3. Control is returned back to textbox2.mousedown() where I set textbox2.text = 0 I've tried overloading the procedure textbox1.drag_and_drop() to include a 3rd, byRef, argument oldValue as String, that I set to the original value of textbox1.text. However this doesn't compile because textbox1.drag_and_drop() HANDLES dragdrop. My question is this: What's the easiest way of getting this done? If I'm going down the right road, how do I overload the dragdrop event so that I can implement this 3rd argument? If I overload the event, do I need to recreate all the code associated with dragdrop?

    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