Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Dragging A Record In Datagrid Into TreeView Control


Dear All
is it possible for us Drag a record and then drop into a Treeview control on the same screen ? If yes,,,HOW

Urgent ! Pls Help

TIA

regard
Jason




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DataGrid Can Select Record Or Start Dragging, But Not Both
Hello!

I am trying to use a DataGrid control in an ActiveX control being built in Visual Basic 6. Eventually, I am going to need to drag the control over another control on the ActiveX control. I have found that when I set the DataGrid's DragMode to vbAutomatic, the mouse pointer changes to my drag icon whenever I click the mouse over the datagrid, and nothing else happens. In particular, the record I am trying to select by clicking the mouse does not get selected! When I change the drag mode back to vbManual, I can select a record, but then I have to start the drag operation myself. Is there something I can do in the datagrid's MouseDown handler that will both select the current record and start dragging?

Thanks very much!

RobR

Dragging And Dropping Outside Of A Treeview
I am attempting to create an application where a treeview has a hierarchal display of data, and the user can drag any item from the treeview to a textbox which is used to create a script.

My problem is this:

Say the root node is currently selected. When the user grabs an item which is not the root node, and drags it to the textbox, the root node is the only thing that gets moved.

If the user first clicks on the item (going through all mouse_down, mouse_up and node_click events) and then clicks and drags, it works fine.

But I'd like it so that the user doen't have to click twice (dragging with the second click) to drag an item outside of the treeview.

If the user drags the item around inside the treeview, the newly clicked node remains selected. But drag it out of the treeview and BAM! The originally selected node becomes selected again.

Any thoughts?

Thanks.

Dragging Items In A Treeview Between Itself
I've got a tree view control in my application and i need to drag its children nodes between the parent nodes. I.e you can be able to change the parent node just by dragging a node from one parent node to anotehr. Is this possible to be done by native VB, or does it need some API involveD?

I've seen several applications using this functionality. Any idea how i can solve this problem?

Thanks!

Dragging With The Treeview (not Very Hard, Honest)
i have a form with a treeview and listview that lets you drag items from the treeview to the listview. however, it should only let you drag child items from the treeview, so i have this code:


VB Code:
Private Sub tvwHeaders_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)    If (Button = vbLeftButton) Then        If (tvwHeaders.SelectedItem.Parent Is Nothing) Then Exit Sub                tvwHeaders.DragIcon = tvwHeaders.SelectedItem.CreateDragImage        tvwHeaders.Drag vbBeginDrag    End IfEnd Sub Private Sub lvwSubHeaders_DragDrop(Source As Control, x As Single, y As Single)    On Error GoTo ErrHandler        If (Source Is tvwHeaders) Then        lvwSubHeaders.ListItems.Add , Source.SelectedItem.Key, Source.SelectedItem.Text, 1    End If        Exit Sub    ErrHandler:    If (Err.Number = 35602) Then        MsgBox "You have already included this list.", vbInformation, "Cannot Add List"    End IfEnd Sub


if you click a child item, then click a parent item, release the mouse button, click again and drag, it won't let you move it (good). however, if you click a child item, release the mouse button, click a parent item (without releasing the mouse button) and drag, it'll drag the parent item (bad). if that makes any sense to you, is there any way i can prevent that?

Scroll The Treeview When Dragging And Dropping
The only information that I can find on scrolling a treeview when dragging and dropping a node is out on microsoft's support online - Article ID: Q177743

http://support.microsoft.com/suppor...s/q177/7/43.asp

The problem that I am having with is solution is that when the mouse button is released over an area other than the treeview area, it continues to scroll. It does not recognize that the mouse button has been released. It also continues to scroll is you drag it off the form, which microsoft applications do not do.

Does anyone have a fix for this or possibly a better solution?

Dragging Items In A Treeview In Itself (changing Locations)
I need to perform a drag-drop function on a treeview control in which the user can move items between different nodes of the tree.

I need to implement this functionality via dragand drop, so as to make it easy to interact. Is this possible? Do i need to go into detailed API or wiht native VB it is possible?

Any ideas? Thanks a lot ppl

Code To AutoScroll Treeview When Dragging And Dropping
Hi Guys,

I need code to autoscroll my treeview whenever I drag and drop an item. Please help me.

Treeview: Dragging And DoubleClicking (harder Then It Sounds)
Hello,

I got a little problem wih my treeview. I want the user to be able to Drag some items and double click on some items. They both work,but the only problem is when you doubleclick on an item (should be quite fast and it doesn't always happens) then it look likes you want to drag what is quite annoying.

Is there anyone who could fix this??

Thanx in advance

Moving Data With Dragging A Treeview Node
i want to move data about a Database connection , from the treeview to a listbox.

i know i could use a ADODB recordset....any ideas how ?

thanks

TreeView - Dragging And Dropping A Node In The Middle Of A Level
Does anyone know how to drag and drop a node within a treeview control in the middle of a level on the same treeview control?

When I use the drag and drop methods, and drop my node on a level I can drop it as the first child under that level or I can drop it as the first node at the same level.

IfI have 5 nodes under a level and want to drop another node in between nodes 3 and 4, it will only drop it before node 1.

Does anyone out there have any codes samples that they are using themselves to do this?

I have search the internet for samples and can not find one that does this.

Show Item Text When Dragging A Treeview Node
Does anybody know how when dragging a treeview node, to display the text property of the node as well as the DragIcon. I want to be able to replate the drag drop behaviour of Windows Explorer, i.e while you are dragging a folder, you can see the folder name in transparent text.

I have no problem setting the DragIcon property from an imageList I have associated with the treeview. For example in the DragOver event I am setting the DragIcon based on whether the mouse is over a valid drop point. E.g. .DragIcon = LoadResPicture("NoDrop", vbResCursor)

However it only shows the DragIcon and nothing else when dragging the node. Any help appreciated.

Dragging Records From One Datagrid To Another...
A newbie here...

Just wondering if I could select one or more records from a datagrid and drag it to another, and save it as an excel file or another table of a database...

I would really appreciate it (I'll be your slave!) :-)

Thanks in advance!!

Need Help Debugging Memory Leak Using APIs To View Treeview Node While Dragging
Hi all,

A long time VB hacker here.

This code is actually working with the first 7 drag and drops but stops working properly on the 8th attempt.

This is the least amount of code I've been able to find to:
View Treeview Node While Dragging.
AND works (well, kind of..) with mscomctl.ocx (v6)


I'm using Microsoft Windows Common Controls 6.0
in VB6 with SP5.

Any help in sorting this problem out and maybe cleaning this code up would be greatly appreciated.

Hopefully, other contributors will find this usefull as well.

Thanks,
Barry G. Sumpter

-----------

Note: This code uses the SetTimer API and exits VB if you stop execution while the timer is still enabled/running.

Only the form_load event code is mine. As well as the Debug.Prints

I've moved all the code that is in module from form1.
I just couldn't get anything to work otherwise. (I AM a hack )

-----------------------

Form1:
-----
Form1 Has 1 Treeview Control Named TreeView3
.....TreeView3 has Style set to 7 - tvwTreelinesPlusMinusPictureText
Form1 Has 1 ImageList Control Name ImageList1
.....ImageList1 which contains 4 16x16 icons with the Use Mask Color Ticked ON

-----------------------

Option Explicit


Public Sub DragComplete()

Debug.Print Now & "- " & "DragComplete"
'
' DragComplete
'
' Removes the drag image
'

' Stop the timer
KillTimer 0, m_lTimer

' End the image dragging
ImageList_EndDrag

' Destroy the ImageList
ImageList_Destroy m_lIL

End Sub


Public Sub TreeView_StartDrag( _
ByVal hWndTreeView As Long, _
Optional ByVal x As Long = 20, _
Optional ByVal y As Long = 20)


Debug.Print Now & "- " & "TreeView_StartDrag"


Dim tPoint As POINTL
Dim hItem As Long

' Get the selected node
hItem = SendMessage(hWndTreeView, TVM_GETNEXTITEM, TVGN_DROPHILITE, ByVal 0&)

' Get a ImageList with the drag image
m_lIL = SendMessage(hWndTreeView, TVM_CREATEDRAGIMAGE, 0, ByVal hItem)

' Start the image dragging
ImageList_BeginDrag m_lIL, 0, x, y
ImageList_DragEnter 0, 0, 0

' Start the timer
m_lTimer = SetTimer(0, 0, 1, AddressOf pvTimerDragMove)

End Sub


Private Sub TreeView3_OLECompleteDrag(Effect As Long)

Debug.Print Now & "- " & "TreeView3_OLECompleteDrag"

DragComplete

End Sub

Private Sub TreeView3_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)

Debug.Print Now & "- " & "TreeView3_OLEStartDrag"

' Stop the timer
KillTimer 0, m_lTimer

TreeView_StartDrag TreeView3.hWnd

End Sub
Private Sub Form_Unload(Cancel As Integer)

Debug.Print Now & "- " & "Form_UnLoad"

DragComplete

End Sub


Private Sub Form_Load()

Debug.Print Now & "- " & "Form_Load"

Dim nodx As Node

Set nodx = TreeView3.Nodes.Add(, , "R", "Root", 1)

Set nodx = TreeView3.Nodes.Add("R", tvwChild, "C1", "Child 1", 2)
Set nodx = TreeView3.Nodes.Add("R", tvwChild, "C2", "Child 2", 2)
Set nodx = TreeView3.Nodes.Add("R", tvwChild, "C3", "Child 3", 2)
Set nodx = TreeView3.Nodes.Add("R", tvwChild, "C4", "Child 4", 2)

Set nodx = TreeView3.Nodes.Add("C1", tvwChild, "C1-1", "Child 1-1", 3)
Set nodx = TreeView3.Nodes.Add("C2", tvwChild, "C2-1", "Child 2-1", 3)
Set nodx = TreeView3.Nodes.Add("C3", tvwChild, "C3-1", "Child 3-1", 3)
Set nodx = TreeView3.Nodes.Add("C4", tvwChild, "C4-1", "Child 4-1", 3)

Set nodx = TreeView3.Nodes.Add("C2-1", tvwChild, "C2-1-1", "Child 2-1-1", 4)

Set nodx = TreeView3.Nodes.Add("C3-1", tvwChild, "C3-1-1", "Child 3-1-1", 4)
Set nodx = TreeView3.Nodes.Add("C3-1", tvwChild, "C3-1-2", "Child 3-1-2", 4)

Set nodx = TreeView3.Nodes.Add("C4-1", tvwChild, "C4-1-1", "Child 4-1-1", 4)
Set nodx = TreeView3.Nodes.Add("C4-1", tvwChild, "C4-1-2", "Child 4-1-2", 4)
Set nodx = TreeView3.Nodes.Add("C4-1", tvwChild, "C4-1-3", "Child 4-1-3", 4)

Dim I As Integer

For I = 1 To TreeView3.Nodes.Count
Set nodx = TreeView3.Nodes(I)
nodx.EnsureVisible
Next

TreeView3.BorderStyle = vbFixedSingle

End Sub

-------------------------------------------------
Module 1
-----

Option Explicit

' ==== Public members ====
Public m_lIL As Long
Public m_lTimer As Long

' ==== API declarations ====

Public Declare Function ImageList_BeginDrag Lib "comctl32" ( _
ByVal himlTrack As Long, _
ByVal iTrack As Long, _
ByVal dxHotspot As Long, _
ByVal dyHotspot As Long) As Long

Public Declare Sub ImageList_EndDrag Lib "comctl32" ()

Public Declare Function ImageList_DragEnter Lib "comctl32" ( _
ByVal hwndLock As Long, _
ByVal x As Long, _
ByVal y As Long) As Long

Public Declare Function ImageList_DragLeave Lib "comctl32" ( _
ByVal hwndLock As Long) As Long

Public Declare Function ImageList_DragMove Lib "comctl32" ( _
ByVal x As Long, _
ByVal y As Long) As Long

Public Declare Function ImageList_Destroy Lib "comctl32" ( _
ByVal himl As Long) As Long

Public Declare Function ImageList_GetImageCount Lib "comctl32" ( _
ByVal himl As Long) As Long

Public Type POINTL
x As Long
y As Long
End Type

Public Declare Function GetCursorPos Lib "user32" ( _
lpPoint As POINTL) As Long

Public Declare Function WindowFromPoint Lib "user32" ( _
ByVal xPoint As Long, _
ByVal yPoint As Long) As Long

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Public Const LVNI_SELECTED = &H2
Public Const LVNI_DROPHILITED = &H8
Public Const LVM_CREATEDRAGIMAGE = &H1000& + 33
Public Const LVM_GETNEXTITEM = &H1000& + 12

Public Const TVM_CREATEDRAGIMAGE = &H1100& + 18
Public Const TVM_GETNEXTITEM = &H1100& + 10
Public Const TVGN_DROPHILITE = &H8

Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Declare Function GetWindowRect Lib "user32" ( _
ByVal hWnd As Long, _
lpRect As RECT) As Long

Public Declare Function KillTimer Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long

Public Declare Function SetTimer Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long

Public Sub pvTimerDragMove( _
ByVal hWnd As Long, _
ByVal uMsg As Long, _
ByVal idEvent As Long, _
ByVal dwTime As Long)


Dim tPoint As POINTL

' Get the cursor position
GetCursorPos tPoint

' Move the image to the new cursor position
ImageList_DragMove tPoint.x, tPoint.y

End Sub


-----------------

Thanks again ...

How Do I Show A New Added Record On A Datagrid Locked To A Child Record?
I have 2 datagrids on my form. One locked to the parent table and the other to the child table using the standard Dataenvironment method.
This shows existing child records OK as I change the parent record. When I add a new record to the child table using a separate recordset method, how do I show this addition in the child datagrid? At present I have to stop the program and restart it to see the new record. I've tried all the refresh and rebind thingys I can think of, at the end of my addnew code, without success. I cant find a way of refreshing the child command of the parent in the dataenvironment except in the design mode?
Regards Ted

Record In Treeview,can Not Swich Record
Hi

Can som help me ???

I use this code to read data to treeview
Bud when I gat same name 2 I can not select I only can select
record 2 not 1 so I can not change record 2 to 1 If i gat the name john tvise, ??? I need to call the record ID and display the name
and when I select the name I read the ID to select record

Can som help me How????



On Error Resume Next
Dim nodType As Node
Dim intTypeKey As Integer
Dim rsTypeChild As ADODB.Recordset
Dim myTypeKey As String
'Select * from Login Where UserName=

strSQL = "select * from bókun where stađa = 'Í vinnslu' and nafn = '" & txtstadur.Text & "'"

' strSQL = "Select * From Bókun Where Where stađa = 'Bókun' "
Set rsType = New ADODB.Recordset
rsType.Open strSQL, conTree, adOpenStatic, adLockOptimistic

Dim i As Long
With tvwAM.Nodes
.Clear
For i = 1 To rsType.RecordCount
Set mNode = .Add(, , , rsType.Fields!Nafn, 2)
rsType.MoveNext
Next i
End With
rsType.MoveFirst

lblRecCount = rsType.RecordCount & " Fćrslur"
End Sub

Dragging In Tab Control
He,
I need to have the capability to switch between tabs by dragging the tab to the desired location.
I don't have any idea how to do it !
Any idea will be really helpfull
Thanks
Sigal

Dragging A Control Along With Your Program
Is there a way to have your program carry a SysInfo control on its back? So that when I copy my program into another computer (it's a USB key backup program) it doesn't cause an error when it can't find the control?

Dragging And Dropping Control?
I am coding to move the control panel around where I wanted to by dragging it. It doesn't move right. anyone can help?

Private xoffset as single, yoffset as single
Private Sub pnTT_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xoffset = X
yoffset = Y
pnTT.Drag vbBeginDrag
End Sub

Private Sub pnTT_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
xoffset = 0
yoffset = 0
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - xoffset, Y - yoffset
End Sub

I am really aprreciate your help.

Dragging A Shape Control
I've been working on a class that will allow me to draw a rectangle on a form and then be able to stretch it by dragging the sides or corners. (Eventually I plan on incorporating it in my Picture Viewer app so that I can crop pictures.) I've run into a problem that has had me stumped for two days and maybe some fresh eyes will find it.

To reproduce the problem, run the app and draw a rectangle on form by clicking the mouse and dragging it. When you do that the rectangle will be drawn very smoothly by dragging its lower right-hand corner. Now release the mouse and move it over the edges of the rectangle and you'll see that "grab handles" appear. So far so good, but now move the mouse to the lower right-hand corner so that the "northwest" grab handle appears there and attempt to drag that corner. The problem is that while you can do it slowly for a while the mouse will eventually "jump off" the rectangle without the mouse_up event having been fired. Note that both the DrawInitial procedure that is used to initially draw the rectangle and the Stretch procedure that is used to stretch it after it's drawn both use the same StretchFromBottomRight procedure so I really don't understand why it doesn't work the same both times.

Dragging An Image Control
Hi Guys

I wish to know how best can i facilitate moving of an Image control at runtime by dragging throug a mouse (with little or no flickering at all).

Regards

Suhaib

Dragging Control - Keep Inside It's Container?
Hi,

I have an image control inside a picturebox. So the picturebox is the image controls container.

I can move the image control about inside the picturebox just fine, but I would like to restrict it to the boundary of the picturebox. I can do this but when you drag the image control up against one of the picturebox's borders the image begins to shake and flash.

So what I'm asking is how can I make it remain solid when it's up against the picturebox's border? I'm sure it's something simple, but I just can't seem to think of a way. :/ I attached an example project.

Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?

Many thanks
Geoff

Setting up control:
Dim itmX As ListItem

lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog

For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime

Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select

MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.



DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub

Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I
have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?

Many thanks
Geoff

Setting up control:
    Dim itmX As ListItem

    lsvEvents.ListItems.Clear
    lsvEvents.ColumnHeaders.Clear
    lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
    lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
    lsvEvents.SmallIcons = imlLog

For each record in a recordset:
                    Set itmX = lsvEvents.ListItems.Add()
                    itmX.Text = !Name
                    itmX.Tag = !EventID
                    itmX.SubItems(1) = !OpenTime

                    Select Case !EventType
                        Case Is = "<Project File>"
                            itmX.SmallIcon = "Project"
                        Case Is = "<Resource File>"
                            itmX.SmallIcon = "Resource"
                        Case Is = "<Issue>"
                            itmX.SmallIcon = "Issue"
                    End Select

MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
   Dim DY ' Declare variable.
   
   
   
   DY = TextHeight("A") ' Get height of one line.
   lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
   lblDrag.Drag ' Drag label outline.
End Sub

Disable Dragging Items In A Listview Control. Help, Help, Help
I don't know how to disable dragging items in a listview control. Please help me. thank you very much

Stop Dragging Links From Webbrowser Control
Hi all,
i'm creating a securelink browser application using
WebBrowser cotrol in VB6.
Our requirment is that no one can't do drag and drop
a hyperlink out side the application ,as one can do
with other browsers.
so how can i do this ,plz help me.

Thanks

Treeview By Month And Record In Children?
HI

Can som show or help me how I can do this

The Field data and the all record are in same Table

How can I sort record by month
I wana tray to call record date and sort by month
so I can blick on Jan to Des and see recort in Jan to Des



On Error Resume Next
Dim nodType As Node
Dim intTypeKey As Integer
Dim rsTypeChild As ADODB.Recordset
Dim myTypeKey As String
'Select * from Login Where UserName=

strSQL = "select * from bókun where stađa = 'Í vinnslu' and nafn = '" & txtstadur.Text & "'"

' strSQL = "Select * From Bókun Where Where stađa = 'Bókun' "
Set rsType = New ADODB.Recordset
rsType.Open strSQL, conTree, adOpenStatic, adLockOptimistic

Dim i As Long
With tvwAM.Nodes
.Clear
For i = 1 To rsType.RecordCount
Set mNode = .Add(, , , rsType.Fields!Nafn, 2)
rsType.MoveNext
Next i
End With
rsType.MoveFirst

lblRecCount = rsType.RecordCount & " Fćrslur"

Treeview && Datagrid
Hi there

Please can someone help me with this. I got a treeview control with nodes.

Inbox
Outbox
sent items
outlook

and the same for the data grid.

Now when i click on Inbox i want it to bring up the dtaInbox.
When i click on the Outbox i want it to bring up the dtaOutbox.

I cant see how to do it in the code as to Bring to front.

Datagrid As Treeview
Can I extend my a datagrid so that it will looks like a tree view?

TreeView To DataGrid (or MSHFlexGrid)
Hi Again
I got alot of help here when I built my Roster Database in Access. Now my Bosses really liked it and want me to make it in a bigger scale to serve our whole Corp. Which means Im trying to build it in SQL with a VB front ( I dont know if you remember but I was new to Access 2000 when I started the project but with every ones help I got it finished

Now to my Question..
I have four comands that are linked to a TreeView starting From Office > Management > Teams > Agents. What Im trying to do is as you go through the tree I would like it if you could select a Team (By doubleclicking on the Tree) and all the Agents Details in that Team would show up in a DataGrid (or MSHFlexGrid).
I hope someone can help,,,,,,,
Thanks

DataGrid Bound To A TreeView?
I have a treeview. Here is it:


Code:
FINISHED_GOOD
|
|_(SUB_ASSY1)
| |
| |_(MAT_1)
| |_(PRO_1)
|
|_(SUB_ASSY2)
| |
| |_(MAT_2)
| |_(PRO_2)
|
|_(MAT_3)
|_(PRO_3)


Legend:
MAT = Material
PRO = Process

My top level part (FINISHED_GOOD) has two sub-assemblies (SUB_ASSY1) and (SUB_ASSY2) that both have a material and a process under each. The finished good also has it's own material and process as well. What I'd like to do is populate a DataGrid based on what node is clicked on. If the top level part was highlighted, the DataGrid would have 3 rows, one for each sub-assembly and one more for the (MAT_3). If I click on (SUB_ASSY1), the DataGrid would only have one row and it would be for (MAT_1) and also if I clicked on (SUB_ASSY2), it would have one row for (MAT_2). I need to know how to do this and I'm not sure where to start. Can someone help me? Thanks, Jeremy

DataGrid/TreeView Like Kazaa?
Hey all. This is probally really simple, but I can't figure it out. How do I insert/use/make a treeview like in Kazaa (only example that I could think of.) What I want is somthing that I can .add stuff to and have the sorting options up at top. Thanks for the help!

Jeff Rapp
jrapp@nctc.net

Datagrid And Record Set
Hi

I used recordset to retrive the data from a SQL table and display in a datagrid, the data will update every 5 to 10 minutes.

I use the following code:

DG1.datasourse = rs

My question is :

1. Can I use other codes to manipulate the datagrid, I would like to choose the rs fileds to display rather then display all of it.

2. Can made the datagrid bgcolor change when the data updated, say if smaller value then red color if greater value is green color

Pls help, I got no idea about these. help.....

Thanks

Kel

Datagrid Record
I am trying to return the datgrid selected row Member_SSN, First_Name and Last_Name fields from my datagrid using the below code I get all 3 fields filled with the first Row.

frmWelfareEligInq.txt_Member_SSN.Text = grdDataGrid.Text
frmWelfareEligInq.txt_First_Name.Text = grdDataGrid.Text
frmWelfareEligInq.txt_Last_Name.Text = grdDataGrid.Text

How To Add Record In DataGrid
I have created a master-detail form.

Master
======
PurchaseID
Attention
DeliveryAddress
OrderDate

Detail
======
PurchaseID
ProductName
Content
Quantity
UnitPrice

I have put a datagrid for the detail section. When I edit the form, I
can able to cancel change in master section but not the detail section. I plan try to save the records in the detail section before editing. When user clicks on the cancel button, I want to load the records back. Can anyone help me to do it.

How To Add Record In Datagrid ?
How to load all record in table out datagrid?

fields in table
firstname
lastname
class
studentscode

how to add,delete,update,seach record ?
when add,update records will be input or appear in textbox !
Can you help me ?
thank alots !

Drag And Drop From DataGrid To TreeView
I have a program where I need to select a row in a DataGrid on one form and drag it to a TreeView on another form. All I have right now is the two forms. Where do I start? They way I'd like to do it is give the user the ability to hold down the left mouse button, give them a new icon showing that they can now drag and drop, then drop it into the TreeView. I'd also like the user to be able to highlight a node in the TreeView and then double click on the DataGrid, the row they want to insert, and add nodes to the TreeView that way. I am new and need some help. Thanks, Jeremy


Edit: Also, how can I make it possible for someone to scroll down there grid without the scroll bars? Using the mouse wheel?

Datagrid Record Selectors
hi, i have a problem with record selectors... whenever i click a row on the grid (Split portion), the record selector goes to the first record. is there anyway to put the pointer at the selected row? also when the mouse down event happens i want the row to be highlighted but till present, the row only highlights when the mouse is released. somebody please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

Record Selection In A Datagrid
Hi!

Just wondering if somebody could push me in the wring direction with the following:

I have a data grid that is bound to an Ado recordset. Scrolling through another Recordset will populate this datagrid with a number of records. I have an option where the use can select Ctrl and manually highlight records and write them to an access table by clicking a btn.

However what I really need is the ability to read all records in the datagrid (there maybe 1 to say about 5) and auto dump them into an Access table (basically so the user does not need to click records in turn becasue at some point I want to automate this process ).


I’m pretty new to VB and my code for manually selecting records is as follows:

For Each varBmk In DataGrid1.SelBookmarks
DataGrid1.Bookmark = varBmk

Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("Code").Value = DataGrid1.Columns(0).Text

And so on for each field in the Datagrid.


Any help would be greatly appreciated.

Thanks

Insert Record Into Datagrid
I want insert record to datagrid when I selected a record from others table. After that, I will save it into database. So, how should I do to make it insert into datagrid before save to database. Anyone can answer me? Thanks You!!

karencyl

Deleting A Record In Datagrid
hi! i've been working on a datagrid and i've noticed that when you delete a record you must select the entire row before you can do the operation. But if you only click on a column on a certain row and press the delete key, the record is not deleted.

Is there any way to tell that once you select a column and row, you also select the entire row?
I've seen the selectedrow property but somehow unknown to the datagrid control.

Any help would be very much appreciated.

Thanks!

Onbleu

Find Record In Datagrid
Hi guys, i need your help again. I have a datagrid that shows some records of a sql database through an ado data control. I'm stuck on searching records. I have put a textbox on the same form, so that the user could put a word (for example the employee name) and then press the search button to find the record in the datagrid and at the same time highlight the row of the record.

I have found that there is a find method but i don't know how to use it. Or is there another way??

Please help me, i am a desperate guy!!!

Winston

Display Record Set In Datagrid??
Hi I have the code below that queries a database and creates a recordset from it. The code then puts the FirstName value of the record into a textbox. However I also want to display all the records queried in a datagrid. How do I alter the code to allow me to do this? I have a data grid on the form called datDataGrid.

Any help would be greatly appreciated.

Thanks.

Ben.

'Declares the recordset globally for this form
Dim MyRecSet As ADODB.Recordset
-------------------------------------------------------------------
Private Sub btnNext_Click()

' Moves to next record
MyRecSet.MoveNext

' Puts the FirstName value of the first record into a textbox
Me.txtName.Text = MyRecSet.Fields.Item("FirstName")

End Sub
-------------------------------------------------------------------
Private Sub Form_Load()
Dim MyConn As ADODB.Connection
Dim strName As String

'Creating the connection
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:Documents and SettingsBenDesktopWADE2CourseworkDatabasehogwarts.mdb;"

MyConn.Open

' Creating a recordset from a query
Set MyRecSet = MyConn.Execute("SELECT FirstName, FamilyName FROM Character")

' Puts the FirstName value of the first record into a textbox
Me.txtName.Text = MyRecSet.Fields.Item("FirstName")

' This needs to go at the end because if it is before the selection
' of data from the recordset then it doesn't work.
' MyConn.Close

End Sub

Deleting Record From Datagrid
I am trying to have the user select a record within a dbgrid and then press a button to delete the selected record from the dbgrid and recordset. However, I am using MSRDC as the datasource for the dbgrid. Any suggestions are greatly appreciated.

Thanks beforehand,
Carola

Datagrid Record Selection
Hi
I am using an datagrid connected to an adocd database

I have a timer in a form and I want a textbox that show a record of this database.
I use this :

i = Rnd()
n = Me.Adodc1.Recordset.RecordCount
num = Round(i * n)

to get an aleatory number of record

How can i get the "num" record of this database ???

Thanks ... it's making me crazy

Can't Insert A New Record Using ADO And A DataGrid
Hello All

I hope someone can help me!

I am trying to insert a new record into a Centura database. I am using ado data control with ODBC and a datagrid for entry. I am trying to use the addnew/update method. The update method is coded in the Save button.

At present, I can update a record without clicking on the Save button but I can not add a new record. I get the error message:

"Data provider or other service returned an E_FAIL status." with error #-21467259 (80004005).

I get this message even when updating, if I click on the Save button. I have tried every cursor and lock type. I am able to retrieve the data, therefore I must have a connection. Does anyone know what else to look for?

Thanks
cheaney

Can't Insert A New Record Using ADO And A DataGrid
Hi,
I am getting the same error with VB and Sybase Database,
I am using ADO with DataGrid Control,
I am using OLE DB for ODBC Driver in my code.

I guess it's do with the odbc driver, because.

As the previous versions of MSSql server odbc drivers used to support the connection to the SYBASE, when I Change my odbc driver from existing SYBASE ASE ODBC Driver to MS SQl odbc driver for connecting to SYBASE, I didn't have any problems of updating the data grid control,

So it's do with the communication between the oledb driver and the odbc driver which is not proper.

So in your case too if you are using OLE DB for ODBC Driver
then it's do with communication between this driver and your centura ODBC driver.

Even I am waiting for the solution.

Changing the datagrid to flexigrid will work I know, but again, it takes lot of code and time.

Anyone please help.

Selecting A Record From Datagrid
hi everyone,
i've created a adatagrid linked to an access DB.
what is generaly the code for the user can Double click on a record within the datagrid and then defines the selected record.

thanks

Selecting Record In Datagrid
With a click in a treeview the records populate a datagrid. Each record has 3 fields; an ID, Title and length. When a record is clicked in the datagrid three
text boxes are filled with the data for editing. There are 2 areas of concern:

1. When the datagrid is clicked the first time the first record is the one that shows up in the textboxes. If the record is clicked twice the correct record is displayed in the textboxes.

2. If the record has an apostrophe, a BOF/EOF error msg appears even though there is a replace statement.

My code for the datagrid:

Code:
Dim sName As String
sName = datagrid1.Text
sName = Replace(datagrid1.Text, "'", "")
sSql = "SELECT TrackID, Title, Length FROM tblTracks WHERE Title = '" & sName & "'"
If rst.State = adStateOpen Then rst.Close
rst.Open sSql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
txtTrack.Text = rst.Fields("TrackID").Value & ""
txtTitle.Text = rst.Fields("Title").Value & ""
txtLength.Text = rst.Fields("Length").Value & ""
Is the datagrid the best way to display the info or should I use the flexgrid?
Andy ideas on the first part would be great. thanx.

Kim

Clear The Datagrid Record
I use ADO, SSTAB and datagrid. My SSTAB have two items 'LOT' and 'OWNER'.After making the query for owner items, I back to the lot items and back again to owner items, the datagrid of the owner record still there. I try to clear the previous record but fail.How I can clear the record in datagrid control?



VB Code:
Private Sub SSTab1_Click(PreviousTab As Integer)'End IfText1.Text = ""Text2.Text = ""End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved