Article View: cn.bbs.comp.lang.visual-basic
Article #53Re: Simple Drag and droop in VB form
From: panfock
Date: Fri, 27 Apr 2007 16:53
Date: Fri, 27 Apr 2007 16:53
35 lines
2230 bytes
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
[m[34m�� ��Դ ����ɾ�bbsվ http://bbs.scau.edu.cn [FROM: 202.116.160.*][m
Technical Details
Message-ID:
<4TelIa$2G_@bbs.scau.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!newsgate.cuhk.edu.hk!news.szu.edu.cn!SCAUShow Full Headers
Complete Article Headers
X-Google-Thread: 109fdd,19e83eeacaa49f1,start X-Google-Attributes: gid109fdd,public X-Google-Language: ENGLISH,GB Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!newsgate.cuhk.edu.hk!news.szu.edu.cn!SCAU From: Panfock@bbs.scau.edu.cn-SPAM.no (panfock) Newsgroups: cn.bbs.comp.lang.visual-basic Subject: Re: Simple Drag and droop in VB form Date: 27 Apr 2007 16:53:25 GMT Organization: ����ɾ� Message-ID: <4TelIa$2G_@bbs.scau.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: VB/M.1177692804.x0