🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.lang.visual-basic
1 messages
1 total messages Started by panfock Fri, 27 Apr 2007 16:53
Re: Simple Drag and droop in VB form
#53
Author: panfock
Date: Fri, 27 Apr 2007 16:53
35 lines
2230 bytes
�� �� cardiolight. �Ĵ������ᵽ: ��
: ��  ��: p50860723.dip0.t-ipconnect.de
: Hello!
: I'm new in VB. I have to use it because I have to do something  in Excel.
: My problem is to realize a simple drag and droop in a VB form.
: What I want to do? Simple. on the left site of my form should be some images 
: and on the right site will be  a shopping basket. For the user it should be 
: possible to drag the images and droop it in the basket. And how ever the 
: user does that, the program add something to the sheet.
: ...................

in my simple, i use the DSN to access the excel file

1��put 4 pictureboxs on the left site
2��set the dragmode to automitic in picturebox'attribute
3��put a listbox on the right site
4��add Microsoft Active Data Object Libary 2.8 reference

write these code on the dragdrop event of listbox
Private Sub lstCart_DragDrop(Source As Control, X As Single, Y As Single)
    Dim conn As New ADODB.Connection
    Dim strsql As String
    strsql = "Insert Into [SheetCart$] Values('" & Source.Tag & "','2',2,45)"  'the sql sentence for insert a record
    conn.Open "DSN=cart"                                                       'open database
    conn.Execute (strsql)                                                      'execute the command
    lstCart.AddItem Source.Tag                                                 'update the shopping cart
End Sub
--
pppppp ffffff
nnnnnn oooooo
aaaaaa cccccc
kkkkkkkkkkkkk

�� ��Դ ����ɾ�bbsվ http://bbs.scau.edu.cn [FROM: 202.116.160.*]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads