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




Drag And Drop Column Headers Listview


Hi,

How can I drag and drop column headers (and all the sub items) so that the user can reorder there view?

Many thanks

Ed




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Listview Column Headers.
Hello All,

I'm haveing a problem with my listview object.

I onl need to have 5 columns shown on the list. However, no matter what I do there is always 6.

Anyway of changing this. I went to column headers & there is only 5 listed. Why do I keep getting six columns?

Thx
Kao.

Listview: Fix Column Headers
Hallo!
How can I prevent the user resizing my listview columns?

Another question:
Can I set the style of a button, so that I get the look of: pushed in, when it is clicked on?

Thank you

Listview Column Headers
Hi-
I am facing problem in Data alignment(right alingment) when I am adding icon in my Listview column headers. Can anybody tell me how can I fix data as right alingment if I use icon in Listview column header?

Sohel

Column Headers In Listview
Hi-
I am trying to wrapping the column header text in two lines but I couldn't. Can anybody tell me how can I wrap/show column headers full text in two lines?

Sohel

How To Get Up Down Arrows On ListView Column Headers
By up down arrows I mean the little arrows that appear in the column headers to indicate whether the data is sorted by ascending or descending order. Anyone know how to have these appear?

Removing Column Headers In Listview
Hello all

I need some help with this,
I have found useful posts on this forum but couldn't find what I am looking for so if you know a post please guide me,
here is the problem:
I have a listview box that loads entries into the box a text file using the code below that I got from a post in the forum,

PHP Code:



Public Function load_listview(MyList As ListView, MyFile As String) 
    Dim line As String
    Dim mydata
    Dim row
    
    MyList.ListItems.Clear
    MyList.View = lvwReport
    
    Open MyFile For Input As #1
    mydata = Split(Input(LOF(1), 1), vbCrLf)
    Close #1
    'mydata = Split(line, ",")
    row = Split(mydata(0), ",")
    
    x = MyList.ColumnHeaders.Add(, , row(0))
    x = MyList.ColumnHeaders.Add(, , row(1))
    x = MyList.ColumnHeaders.Add(, , row(2))
    x = MyList.ColumnHeaders.Add(, , row(3))
    
    For i = 1 To UBound(mydata)
      row = Split(mydata(i), ",")
      
       x = MyList.ListItems.Add(, , row(0)).ListSubItems.Add(, , row(1))
       x = MyList.ListItems(i).ListSubItems.Add(, , row(2))
       x = MyList.ListItems(i).ListSubItems.Add(, , row(3))
    Next i
    
 End Function 





all works well, but it seems to load the column headers twice, I am not sure why, in my text file I have the column header titles only listed once!

I want to remove the duplication in the listview for the column headers,
How do I do that?
I know that

ListView1.ListItems.Clear

Will clear the items in the listview but how do I clear the column headers?

Thanks for reading

Adjust Column Headers Ina A Listview
Hi people
how can I do to lock the columns header of a listview, to don't allow the user change the width of each column

Height Of Column Headers In A Listview
How do I control the height of a listview columnheader? This is my initializing code, and below is what comes out of it,
Code:
code, and the attached picture shows what it produces.
Private Sub InitListView2()
Dim lvw As Single

lvw = ListView2.Width
ListView2.ListItems.Clear

With ListView2.ColumnHeaders
.Clear
.Add , "Name", "Name", lvw * 0.48
.Item("Name").Tag = LVTypeString
.Add , "Address", "Address", lvw * 0.48
End With

End Sub

Listview - Lock Column Headers?
I have a listview in report view, how do you stop the moving of column width? So they are the size i set?

2-line Listview Column Headers?
I have some very long column names with very short data & would love to be able to have 2-line headers. Can this be done? (v4). Thanks.

ListView - Information & Column Headers
Hey,



I Have a listView control with two headers. ID and Name. But i want to add the information e.g

listview1.listitems.add , , ID(1) & Name("Test")



Pleaase could someone help


Regards,
Daniel

 

Edited by - danielgraham on 4/12/2005 12:08:21 PM

Moving ListView Column Headers
Is there a way that the user can move the Column headers of a list view control. Additionally a way to select the whole line rather than the first column.

Thanks.

Sorting A Listview By Clicking Different Column Headers
I can't seem to find a way to sort a listview based on which column header is clicked. For instance when I click on a column header that is assigned to file names I want it to sort alphabetically, and when I click on a different column header I want it to sort by date. Another column header for time...

Can anyone help?

Thanks,
Bernie

Word Wrap The Column Headers Name In Listview
Hi. I'm wondering if it is possible to word wrap the column headers so that the whole name of the column header will be seen and no ellipses will be seen to indicate that the column name is actually longer than what was shown....

I mean I have a columnheader that has a caption that requires a bigger width size. But I can only alot it to some some measurement because of the design. Can I Have it appear this way


---------------------
/ Last /
/Transaction /
---------------------


Instead of...

-----------------
/ Last Trans.../
----------------

Anyone has an idea?

Drag & Drop Column In Datagrid
Does any1 know how to drag a column heading and move it around?
All helps and comments are greatly appreciated.

Remove A Column By Drag-Drop
Is it possible to remove a column of a datagridview by dragging it and dropping it to an other area?
Something like when you want to reorder the columns but to be able to move the column you clicked out of the datagridview.

ListView's Column Headers Text Color (URGENT!!)
Hi,
I need to find out a way to change the fore color of the text in the column header of a list view. So, if anyone knows anything about it, or has the code to do the same, please hit me back soon as this is really urgent.
Thanks a lot in advance.
Bye

How To Merge Cells, Drag Drop Column
Hi everyone,

I read many mail about how to merge cells and move columns inside a Flex
Grid.

I'm sending this simple example to the one who needs to know how.

All you have to is to open a new exe project and add the FlexGrid Component
named by Fgrid and paste the code below.

Have a nice day everyone and take care







Dim MyValue As Integer

Dim OddOk As Boolean

Dim OddStr As String

Private Sub Form_Load()



Fgrid.Redraw = False



DoInitialSettings

FillGrid

Fgrid.Redraw = True





End Sub

Private Sub Fgrid_DragDrop(Source As VB.Control, X As Single, Y As Single)



If Fgrid.Tag = "" Then Exit Sub

Fgrid.Redraw = False

Fgrid.ColPosition(Val(Fgrid.Tag)) = Fgrid.MouseCol

Fgrid.Redraw = True



End Sub



Private Sub Fgrid_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)



Fgrid.Tag = ""

If Fgrid.MouseRow <> 0 Then Exit Sub

Fgrid.Tag = Str(Fgrid.MouseCol)

Fgrid.Drag 1



End Sub

Function FillGrid() As String



Dim I As Integer



For I = 0 To 10



DoEvents:



OddNo I

If OddOk = True Then MyValue = I + 1



Fgrid.AddItem I + 25 & Chr(9) & I + 75 & Chr(9) & "Test" & MyValue,
Fgrid.Rows - 1



Next I

Fgrid.RemoveItem (Fgrid.Rows - 1)



End Function



Sub DoInitialSettings()



Dim I

Fgrid.Row = 0

Fgrid.ColAlignment(0) = 7



For I = 0 To Fgrid.Cols - 1



Fgrid.Col = I

Fgrid.Text = "Col" & (I)

Fgrid.CellFontSize = 14

Fgrid.CellAlignment = 4



Fgrid.MergeCol(I) = True

Fgrid.ColWidth(I) = 2000

Next I



Fgrid.MergeCells = flexMergeRestrictColumns



End Sub

Function OddNo(OddNum As Integer)



OddStr = "0"

OddStr = InStr(1, Str(OddNum / 2), ".")



If OddStr = "0" Then

OddOk = False

Else

OddOk = True

End If



End Function







Best Regards,

_____



Ayman Mohammad Annan
Programmer & Technical Support
UNDP project at Ministry Of Foreign Affairs
Riyadh - Saudi Arabia

Office: +966 5 4055000 Ex 3651
Mobile: +966 5 9007577
E-mail 1: email@removed
E-mail 2: email@removed

_____

Need To Drag &amp; Drop From Data From Column 1 Of MSFlexgrid To Row 1 Of The Same Grid
Hi Guys,

I need to Drag data from Column 1 of my MSFlexgrid to Row 1. How do I do it. Please give me an example with all the steps. Picture this, I have column 1 with each pupil of a class on each row. In row 1 of my grid I have different headings for each column Like Punctuality which is has 2 subheadings, positive and negative.

Now when I drag a pupil name onto the positive subheading a tick will appear in the positive column for punctuality.

Hope I've explained it ok. Please help me.

Listview Drag And Drop
Hi,
i have a listview set up as a listing of files.

I have the drop function up and running so the user can drop files straight into the list but what i can get working is the drop function.

All i want to be able to do is have the user drag the selected items from the list outside the form and return the address of where the files are to be dropped as a message box.

If anyone can help or point me in the right direction it would be great,
-Dave

Listview Drag &amp; Drop
Hello,
Can someone please point me in the direction of an example of using drag & drop within listview. I've been searching the web and keep coming up empty handed!

What I'm trying to do is something like Winamp does in it's playlist for example. I would like to be able to drag a full row of data and drop it in another row.
Thank you!

Listview Drag N Drop
Hi anyone have any ideas how to create a drag N drop between two listviews? I keep coming up with an error with this code, the line that is red is where the error comes up:


Private Sub lstview1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim c As Long

Set lstview1.SelectedItem = lstview1.HitTest(X, Y)
c = lstview1.SelectedItem.Index
lstview1.DragIcon = images.ItemIndex(3)
lstview1.Drag vbBeginDrag

End Sub



Private Sub lstview2_DragDrop(Source As Control, X As Single, Y As Single)
Dim LI2 As ListItem, LI3 As ListItem, i As Byte
Set LI3 = lstview2.HitTest(X, Y)
If LI3 Is Nothing = False Then
Set LI2 = lstview2.ListItems.Add(LI3.Index + IIf(LI3.Index < Source.SelectedItem.Index, 0, 1), , Source.SelectedItem.Text)
Else
Set LI2 = lstview2.ListItems.Add(, , Source.SelectedItem.Text)
End If
For i = 1 To lstview2.ColumnHeaders.Count - 1
LI2.SubItems(i) = lstview2.SelectedItem.SubItems(i)
Next i
lstview2.ListItems.Remove lstview1.SelectedItem.Index
LI2.Selected = True

End Sub

Drag &amp; Drop In Listview
Hi Everone!

I would like to know, how I can drag & drop rows IN a listview.
I've seen some examples for a listbox, but not for a listview...

Thanks a lot!

Greetz Kevin,

ListView Drag 'n Drop
I have most of the functionality for dragging and item from a listview and setting the text in a textbox to that data. However, when I drag the the item I get a drag icon that to the user code be interpreted as dragging the whole list. Basically, instead of a small rectangle I'm getting a big one. How would I go about fixing it?


Code:
Dim strHolder As String
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not (ListView1.HitTest(X, Y) Is Nothing) Then
ListView1.HitTest(X, Y).Selected = True
strHolder = ListView1.SelectedItem.Text
ListView1.Drag
End If
End Sub

Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is ListView Then
Text1.Text = strHolder
End If
End Sub

Private Sub Text1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
If TypeOf Source Is ListView Then
If State = 0 Then Text1.BackColor = &HFFFFC0
If State = 1 Then Text1.BackColor = &HFFFFFF
End If
End Sub

Help With Listview Drag And Drop
I have a listview with folders on top with files listed after them. I want the user to be able to drag and drop a file into a folder. I know this can be done with drag and drop, however is there a way to auto scroll up or down when the user drags the file that way.

Thanks

Help With Drag/drop From Listview
I have a ListView control and a number of text boxes.
When I try and drag/drop from the listview to a text box or list box
I get the error 438
'Object doesn't support this property or method'
can any one help ??

Drag And Drop On ListView
Is there a way to use a drag and drop operation on a listview control itself. For example if I wanted to move a file on a listview control to a folder in the same listview control. Can this be done?

Thanks

Listview Drag Drop
How do you drag a row in a list view box an drop it to another part of the list view so that the row is inserted between the two rows where the drop occurs.

Listview Drag And Drop
Does anyone know how I can drag and drop multiple values from one listview to another. Using the listview_OLEDragDrop event I can transfer 1 value, but it doesn't work if my source listview allows multiselect.

Listview Drag And Drop
Hello there,

I have a listview with 3 columns.
I Want to drag the 3 colums to a textbox.
I use the statement CentralMemoListFrm.liMemo.SelectedItem = CentralMemoListFrm.liMemo.HitTest(X, Y) to determine which row us selected.
But this statement selects the text of the first column instead of the third.

Does anybody know how to select the text of the 3 column of the row selected?

Many thankx!!!

Drag Drop With ListView
Yeap... I missed the cDItem class. Here you have the code. Hope it helps.

ListView Drag And Drop
How can I do drag and drop with a listview?

Drag+drop Listview
How can I drag at list view item (it should show the icon I specify when it is being dragged) into a richtextbox, then have text go in the rich text box where I drag the listview item to?

Drag And Drop Within Listview
Hi,

I've been using VB6 for a while now, and I've created a couple of programs from it. I've recently started using OLE Drag and Drop to be able to do several things, and all seems well when "copying" an item within the same listview. However, I can't work out how to "move" an item within the same listview. I am able to code it to the point whereby it can detect whether I want to move or copy the item, and whilst I know what to do to copy an item, I do not know how to move an item within a list view.

I hope this makes sense, and if anyone has the answer (which is probably pretty easy), it would be much appriciated.

Tim.

Drag N Drop With ListView
I would like to drag an item from one list to another
I could use a sample and some property settings

Thanks in advance

Thom Boglino
CLC Education
Thom Boglino :)
The Computer Learning Center
727-847-6955
352-683-7255
email@removed
email@removed

*Copyright (c) confidential message. No redistribution.
This message is intended for the use of the addressee
only and may contain confidential or privileged information.
If you have received it in error please notify the sender
and destroy it. You may not use it or copy it to anyone else.

How To Drag And Drop In Listview?
Hi guys,

I'm using VB.NET.

I have a simple application. Just a form, and a ListView.

I have a procedure in the form, it read's all the files in my specificed local drive, and show the files name, size and created day. It works perfectly.

Now, I want add a drag and drop functionality in this application. For example, when I drag a file from my desktop, and drop it in the list box, it will do the following:

  - Add the file's name, size and date into the listview
  - Copy the file to my another specificed path

My problem is simple, I don't know how to do it! :)

Can anyone give me a sample code and let me figure it out, or give me some hints, advice or anything can help.

Thanks in advance :)

Andy

ListView Drag And Drop
how can i drag from a listview and drop in another control, like listbox or flexgrid

Drag Drop With A Listview
i have a listview that has to colums. i want to be able to drag an item and drop the information (from the 2 columns) to another part of the form, like a label.

can anyone help me with this????

gkc

Drag And Drop In ListView
Hi,
I am trying to drag and drop multiple items from a listview on to a treeview node which will ultimately be updated in a corresponding table in the database(just like selecting multiple files in windows explorer and copying to different nodes).My problem is I am not able to drag all the items that I select.When I drag only one Item gets selected,Could somebody help me with this problem or give me some suggestions.Any suggestions will be highly appreciated.
Thanks in Advance
Cheers,
Suvipra

Drag And Drop From Listview Onto Listbox
I need to be able to perform a drag'n'drop from a listview in report-view mode onto a listbox.

I can get the first item (I want to multiple select too) that is dropped, however I cannot do the following:

1) I want multiple, performing a For Each vfn In Data.GetData(1) doesn't work, I get can the first item by msgbox data.getdata(1)

2) The destination listbox, how can I tell what item in the listbox that the dragged objects have landed on.

Cheers!

Carl.

Listview Drag Drop To Folder
I have 2 listviews. One is a list of folders and the other is a list of files. I want to be able to drag selected files to a folder in my list of folders.

Thanks

Drag&amp;Drop And Multiselect In Listview
Hi,

i have a litle problem.
I have activate multiselect on my listview.
But the multiselect doesen't works. I know why.

I have the MouseDown option for the drag&drop:


Code:
Private Sub PN_ChartVersionList_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Shift = vbAltMask Then
Set PN_ChartVersionList.SelectedItem = PN_ChartVersionList.HitTest(X, Y)

If Not PN_ChartVersionList.SelectedItem Is Nothing Then

PN_ChartVersionList.Drag vbBeginDrag
End If
End If

'PN_ChartVersionList.SelectedItem = Nothing
End Sub

yet i must let held down the alt key to drag and drop because otherwise the mutliselect doesen't works.

How can I resolv this problem, that i can drag&drop or multiselect the items without press any keys exept for the multiselect the (ctrl + shift) key.

sry for my english :/

Drag&amp;Drop Between TreeView And ListView
Hi,

How can i drag&drop items between a TreeView and a ListView?

best regards,
z3r0x

Treeview/Listview Drag And Drop
Hello.

I have 2 questions about dragging into a listview:

1)
Where can I get the code for dragging a specific node from a treeview, into a listview (I just need to add the value of the dragged node as a new record in the listview).

2)
I also look for the code for dragging a file from the desktop into a listview. There are lots of exmaples on the internet for doing this, but I need to drag a file into a listview control (and not any other control).

Thanks,
Edi.

P.S.
I use VB6 and not .NET

Drag And Drop Into Listview Crashes VB
Hi,

I have two multiselect listviews in which I have OLEDrag methods/events handling drag/drop of listitems between them. If I select all of the listitems from one listview, drag and drop into another, it will *usually* cause the VB IDE to crash with a general protection fault! I've tried everything to track this one down and now I'm at my wit's end.

The problem relates only to the OLE drag/drop since I can move the same listitems via a command button (click) procedure call and it works reliably every time.

I cannot be the only one who has experienced this, so if any one has seen this sort of behavior before, please contact me! I'm running VB6 SP6, with latest mscomctl.ocx (6.1.97.86)

Much thanks,
PJ

Listview (Report) Row Drag &amp; Drop
Hi,

I have a listview on a form which has items in it, what I would like to do is enable the user to drag & drop (manual sort) a row within the listview.

The list view is in report mode.

The following is what i have so far, but it only removes the row to the end of the list, how do I reference the index after drop to insert the row I am moving?

[[ code ]]

Private Sub Form_Load()
Dim Li As ListItem

ListView1.ColumnHeaders.Add , , "1"

Set Li = ListView1.ListItems.Add(, , "hello")
Set Li = ListView1.ListItems.Add(, , "hello2")
Set Li = ListView1.ListItems.Add(, , "hello3")
Set Li = ListView1.ListItems.Add(, , "hello4")
Set Li = ListView1.ListItems.Add(, , "hello5")
Set Li = ListView1.ListItems.Add(, , "hello6")

End Sub

Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, _
x As Single, y As Single)
Dim c As Long
Set ListView1.SelectedItem = ListView1.HitTest(x, y)
c = ListView1.SelectedItem.Index
ListView1.DragIcon = LoadPicture("C: est.ico")
ListView1.Drag vbBeginDrag
End Sub

Private Sub ListView1_DragDrop(Source As Control, x As Single, _
y As Single)
Dim li2 As ListItem
Set li2 = ListView1.ListItems.Add(, , Source.SelectedItem.Text)
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End Sub

[[End Code]]

Basically I am trying to move one entire row with a listview. Thanks alot for any help provided, I have been pulling my hair out on this one!

Rgds,
Dan

Drag-drop Listview Items?
How can i ...(The Title)

Drag &amp; Drop Within A Listbox Or Listview?
Let's say you have a listbox containing 50 items (rows) that is populated from a database table. That listbox is sorted 1 through 50 based on a field called "ORDER".

If I want to allow the user of my VB application to change the order of the records (and the order field accordingly) using drag and drop, is that possible? What I'm thinking is that they can click on, say, item 32 in the list, and drag it up or down the list to the spot they are looking for and then my program will reorder everything.

Basically, my software has a combobox that is populated and ordered using this table. On certain occaisions the user has to change this order (for data entry purposes), so they need a fast way to go about this. The way the previous programmer made it, once they order one thing differently, they have to go all the way through the list again and reorder everything else. Any tips on how to make this smooth and relativley effortless for the end user would be appreciated.

Thanks again everyone

Another ListView Drag Drop Question
Hi All,

Please tell me how to do this. When I drag across from one listview to another I want the dragimage to show the actual text being dragged accross but with sort of a watermarked effect. Any help would be greatly appreciated.

Thanks.

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