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




Listview Setting No Column Dragging


Hi all
you know how with the listview columns you can drag them?
howdo i stop this or get it to resize as soon as the user drags it so its kind of asking howto set the drag to be undraggable


Tom




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Inceasing The Size Of The Cell/Column By Dragging MSFlexGrid
Hi all,
How can i increase the size of the column of the MSFlexGrid by Dragging it or by Double Clicking on the separators of the fixed columns..... Urgent pls help.............

ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?

thanks...

Listview - Turning Off Dragging
I'm in one of my old apps and noticed that for some reason I used a listview control when a listbox "might" have done the job. My comments aren't as good as they should be (lesson learned). Anyway, since I'm not sure why I used a listview instead of a listbox I'm not willing to replace it. I don't have the time.

So... Is there a property (that I can't find) that turns off dragging of items in the listview control?

Thanks,
Bernie

Dragging And Dropping From One Listview To Another
Hi all,

How can I drag and drop multiple items including their subitems from one listview to another. Please help.

Thanks,
Nitesh

Dragging Listview Items
How to drag Listview Item to another form with the same format of Listview.??? hElp please??

Listview Dragging Item
Hello, Jusk asking if there is a possible way to drag item in the listview??

it goes like this:

Listview populate with;

Item 1
Item 2
Item 3

When I drag Item 3 to the position of Item2, it goes like this;

Item 1
Item 3
Item 2


is this possible?? if not?? what should I do??

Listview Icons And Dragging
Is it possible to have the listview Items containing icons not able to drag? If so how?

ListView And Turning Off Dragging
I have Listview with a number of items and I want a user to be able to select an item by clicking on it. Currently, if they click and drag then the icon and text go flying all over the window. How do you keep them from being able to click and drag on the icons messing up the entire list view but still allow them to click and select one? There are a number of related posts but noone seems to have a straightforward answer and this seems easy. Help please!

Thanks.

Create Shortcut By Dragging From Listview
Was wondering if someone could show me an example of creating a windows shortcut by dragging an item out of a listview control and say onto the desktop.

When creating the shortcut I would like to link to a specifix .exe, but use what was dragged out as part of the command line parameters.

Thanks in advance

Listview: Disabling User Dragging
Is there a way to disable the user from dragging items in a listview. My listview.view=lvwIcon and has to stay that way (e.g. I need the nice large icons)

Thanks in advance,

Dragging Multiple Items From A Listview
i have some code to let users drag an item from a listview onto a treeview node, which works fine, but now i want to let them drag multiple items.

the problem is that when then select a bunch of items, then drag them to the treeview, it leaves only the last item they clicked on selected (as if they selected them, then just left-clicked one of them). is there a way to keep them all selected?

also, just out of interest, is there a way to make the drag icon include some text from each selected listview item along with an icon (like when you drag multiple files in windows explorer)?

thanks for any help

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

Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!

thanks!

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

How To Copy And Modify Listview Column Items And Put It In Diffrent Column?
Hi all i got a listview with first column has songIDs i want to for each item in songId column to take its value and add http://localhost/new/play.php?d=04&song= to it and to make it http://localhost/new/play.php?d=04&song=1234 and fill url column. But i do not know . could any one help me achive this .thanks

Please Double Check This Dragging From ListBox To ListView Code For Me
I want to drag an item from a listbox to a listview so starting with my lisbox code:

Private DragID As Integer
Private blnAmDragging As Boolean


Code:
Private Sub lstUnalloc_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DragID = lstUnalloc.ItemData(lstUnalloc.ListIndex)
End If
End Sub



Code:
Private Sub lstUnalloc_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo errh

If Button = vbLeftButton Then
If lstUnalloc.ListIndex >= 0 Then
blnAmDragging = True
lstUnalloc.Drag vbBeginDrag
End If

End If

Exit Sub

errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstUnalloc_MouseMove ()"

End Sub


and now my listview:

Code:
Private Sub lvwPeople_DragOver(Source As Control, x As Single, y As Single, State As Integer)

On Error GoTo errh

If blnAmDragging = True Then
If State = vbLeave Then
Set lvwPeople.DropHighlight = Nothing
Else
Set lvwPeople.DropHighlight = lvwPeople.HitTest(x, y)
End If
End If

Exit Sub

errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstlist_DragOver()"

End Sub



Code:
Private Sub lvwPeople_DragDrop(Source As Control, x As Single, y As Single)

If Source = "lvwPeople" Then
Exit Sub
End If

Source.Drag vbEndDrag

Set lvwPeople.SelectedItem = lvwPeople.HitTest(x, y)

MsgBox lvwPeople.SelectedItem.Key
MsgBox DragID

End Sub


I just put 2 msgboxes to test. I have to write sql statements to assign the number to a person. I just need someone to check if I am doing the correct stuff for dragging and dropping.

Finding The Sum Of Two Column Items And Then, Then Sum Of Column (listview)
I have been working hard on this and I cannot get the sum (subtotal) to be right. Have tried many things and its just not cooperating. Please see screen shot attached.

Also, I have two test records in the DB and only one is showing which makes no sense.

Code below. Thanks in advance for any assistance.

VB Code:
Private Sub cmdViewAll_Click()    'view all time logs in database    'order the records by insert date        'open a connection to the database    MyMySQLConnection        'perform an SQL query on the database and order by the insert date    strSQLTimeLogViewAll = "SELECT * FROM TimeLog"        'open a recordset    OpenTimeLogViewAllRecordset        'populate the listview (lvwTimeLog)    With rsTimeLogViewAll        If .RecordCount = 0 Then            'do no populating        Else            Do Until .EOF = True            Dim LstTimeLog As ListItem                        'lets first clear the list view            lvwTimeLog.ListItems.Clear                        'populate the list view            Set LstTimeLog = lvwTimeLog.ListItems.Add(, , .Fields("JobNumber").Value)                LstTimeLog.SubItems(1) = .Fields("CompanyName").Value                LstTimeLog.SubItems(2) = .Fields("Category").Value                LstTimeLog.SubItems(3) = .Fields("Comments").Value                LstTimeLog.SubItems(4) = .Fields("StartTime").Value                LstTimeLog.SubItems(5) = .Fields("FinishTime").Value                'get the subtotal of subitems 4 + 5                Dim strFirstValue   As String                Dim strSecondValue  As String                Dim strValueTotal   As String                                'do the calculation                strFirstValue = LstTimeLog.SubItems(4)                strSecondValue = LstTimeLog.SubItems(5)                strValueTotal = Val(strFirstValue) + Val(strSecondValue)                                'add it to the last column                LstTimeLog.SubItems(6) = Format(strValueTotal, "HH:NN")            .MoveNext            Loop        End If    End WithEnd Sub

Setting A Column Heading In VB6
How do I set a column heading from within VB6 ?

Thanks
Dom

Setting Column Width
I am using the MSFlexGrid and want to set the first Col width to be smaller than Col 2's width.

Here is the code I wrote:
With MSFlexGrid1
.Row = 0
.Col = 0
.ColWidth = ?
End With


What is a valid value for the column width in twips? I used 400 and I get a "Compile error: Argument not optinal" I never used twips before so I am not sure if they are looking for a numeric value or not...

Any ideas to set the column width?

Thanks,
Bill

Setting Column Size
how do i change the size of my columns when displaying a database in a DBGrid?

gary

Setting The Width Of A Column
Hi
I am exporting data from a recordset to an excel worksheet.I want the destination worksheet to have:
The width of the Column A set to 10
The width of the Column B set to 20
The width of the Column C set to 35
The width of the Column D set to 90
..

hOW can i do it?

ADOX Column Setting
Does anyone know how to set a new column as a Yes/No with the format of a Yes/No through ADOX code?

I have the new column as a Yes/No, but I can not figure out or find how to set the format to Yes/No.

Here's what I have...


Set tblADO = New ADOX.Table
Set tblADO = catADO.Tables("Intake")
With tblADO
Set colADO = New ADOX.Column
With colADO
.Name = "Ineligible"
.Type = adBoolean
End With
End With

Set tblADO = Nothing
Set catADO = Nothing

Excel - Setting Column Properties
Is there a way to select a column and select the default formatting? I'd like to specifiy a numeric field with a size of 9 characters so 000000456 would not be converted by excel to 456.

Thanks in Advance.

Setting Column Width In Excel Using VB
I am currently writing a program in Visual Basic 6.0 and I am put the information that is generated into Excel. I have a my cells all formated they way they should by using name.columns.font.size = 13 and other formatting. I just have one question on the formatting though. I want all my columns to autofit, except for one which I want at a fixed size. I have all my columns to autofit right now, how do i get the one at a fixed size. Thanks in advance for the help

Setting Of Table Column Width
I'm trying to add tables on the reports that I'm trying to generate on a simple VB Application. Like the following codes:

ActiveDocument.Tables.Add Range:=Selection.Range, numrows:=3, numcolumns:=2

Surely, i have added the table in the document, but my question now is how can i set the width of each column when they have different width ??? I hope somebody can help me ... Thank you!

Setting Range To Last Excel Column (IV)
Sorry for the newbie question but i can't find the answer on the net or in the reference book i have. I have a loop to find some text that i wish to run until the last column of the worksheet, as in column IV. I have a similer loop to find the last row, which looks like this:


Code:
Loop Until StartAt.Row = 65536

I have tried using:


Code:
Loop Until StartAt.Column = IV

However that seems not to work. Is there another way to reference this cell using numbers instead of letters?

Setting Column Width In MSHFLexGrid
Hi:

Can you set the width of a column in an MSHFlexGrid at design time? If so, could you give me an example of how this is done.

Thank you and Happy Holidays.

Setting Default Value Of Column Through ADOX
hello,
How can I set the default value of a colunt through ADOX.

tabTempTable.Columns("ABC").Properties("Default").Value = "N"

By this code I am getting error.

Thanks in advance.

Setting Column Widths Of A ListBox
I am using the code below to set the width of columns in a ListBox on a UserForm in Excel. However, I get the error "Could not set the ColumnWidths property. Type mismatch". Any thoughts?

Code:
Private Sub UserForm_Initialize()
ThisWorkbook.Sheets("Sheet1").Activate
colCnt = 2
Set rng = ActiveSheet.UsedRange 'Range("A3:B25")
With ListBox1
.ColumnCount = colCnt
.RowSource = rng.Address
cw = ""
For c = 1 To .ColumnCount
cw = cw & rng.Columns(c).Width & ":"
Next c
.ColumnWidths = cw
.ListIndex = 0
End With
End Sub

Setting Column Widths In MSHFlexGrid's
Hi,

How do I set a column with in a MSHFlexGrid1?

Cheers

T.

Setting Datagrid Column Width?
Hi,

I would like to set column widths in my datagrid at run time. I tried
DataGrid1.Columns(i).Width = xxx but it had no effect.

I also looked at the design time properties page but was only able to set
properties for columns 0 and 1.

Any suggestions will be greatly appreciated.

Thanks,
Lance

Need Help Setting Column Width In Access
Please forgive me if I'm posting this in the wrong place.

a little background...
I'm new to programming, starting learning by myself a month ago. So far I've been teaching myself VB, ADO and ADOX.

My question..
I'm trying to specific the width of each column in my access 2K database or set that property to AutoFit. The database have 40+ fields so I really dont want to set them manually each time. I've been able to set other properties; DefinedSize,AutoNumber..etc... just cant seem to get the AutoFit working. Thats the only thing stopping me from completing this project.

I've pretty much concluded that this cant be done in ADO but I beleve it can be done in DAO

So if someone can post me an example of how it can be done in DAO I would greatly appreciate it.

Thank you

Setting The MSHFlexGrid Column Headers
I am populating a MSHFlexGrid control using a linked ADO control. I select 'Retrieve Structure' and the MSHFlexGrid control is populated with the data in my Access database however the column headers are populated using the Access database column headers. Is there any way to change the column Headers to different headers as I don't want to use the headers in the Access database?? I tried using:

MSHFlexGrid1.colHeaderCaption(0,0) = "Customer Name"

However, it doesn't change the column name at run time.

Can anybody please advise if the column headers can be changed in code??

Thanks,
E

Setting VBA ListBox Column Heading Text
Hello all --

I've got a small project that returns the results of a non-database search to the user in a form with a listbox. I've figured out the multiple columns bit, and the columnheads = true bit, but the question then becomes how the heck to set the column heading text. As it is all I have are the blank boxes across the top where the headings would go. The docs for the Microsoft Forms 2.0 Object Library contain nothing helpful.

I found something tantalizingly close over on MSDN, but I can't get it to work, and I suspect it's only for Access-based projects, but I'm only using Word and Excel. When I try to access ListBox.RowSourceType, I get a "property not found" error. Plus the object browser tells me this control property only takes an Integer, but the MSDN page says I should feed it a string...?

Furthermore, this project is meant for use from within Word 97 (the setup at my office, so no, can't upgrade , so I would like to avoid having to use ListBox.RowSource = some Excel range if possible.

If push comes to shove, I guess I could always cludge in a few labels above the columns and go with that, but real headings would be nicer...

TIA

Setting ComboBox Items To A Column In A Database
I'm looking to set the item list for a comboBox from a column in my database. How can this be done?

Setting Column In 2d Array To Fixed Length
I have a 2d array that has a number that designates a quantity

I need this field to be 5 characters long
putting the appropriate number of spaces at the beginning of the number

e.g.
" 1"
" -1"
" 111"
"11111"

Setting Cursor Position In A Grid Column
Hello,

I am retrieving the user input (real time) and checking for line feeds, paragraph returns, etc.. etc... But when I do this my cursor is set to the beginning of the column in the grid. How do I move the cursor over in the grid column?

example when typing instead of hello it says olleh.


thanks

Setting Property For A Single Column In Grids
Hi all,

I would like to show some data in Grid/Flexgrid. I wanted to show a particular coloumn in a different font. I mean for a particular column i like to show it in a different stlye(Font,Color etc.,).

Thanks in advance

prabhakar

Setting Column Widths In A Grid Control
Using Visual Basic .net 2003

How do I set column widths of a GridControl when a form loads?

Thanks for any assistance

Byron

Setting A Primary Key To A Column In A Table Using ADOX
AFTER CREATING A DATABASE IN ACCESS AND MAKING TABLE INSIDE THE DATABASE,HOW TO ADD A PRIMARY KEY , COMPOSITE KEY,FOREIGN KEY CONSTRAINT TO A COLUMN IN THE TABLE.

Excel Automation, Walking Down A Column And Setting Values
I've generated a pretty slick Excel automation that I'm using through one of my ASP.NET aps. Basically what it does is;

1. dump a .CSV file
2. open the CSV and copy all of the data in the file
3. Open a second Template (XLT) file and paste the data into the template
4. Run a macro on the pasted data in the template, and save it as a new EXCEL (XLS) file

What I need now is to walk down Column A starting at A2 (where the data starts) and look for reacurring data, if it's there null the field:

For example Column A looks like this

PartNumber
.001-2123
.006-0047
.006-0047
.006-0057
.006-0205
.006-0205
.006-0205
.007-0047
.007-0109
.011-0048
.017-0080
.017-0080
.021-0080

but I want it to look like this

PartNumber
.001-2123
.006-0047

.006-0057
.006-0205


.007-0047
.007-0109
.011-0048
.017-0080

.021-0080

So that the parent part number is listed and any child ones are null. If there are duplicate childs they will fall directly under the parent, so it's not like I need to worry about the part further down in the spreadsheet.

Now I have done this in a VBscript, using a SQL-SERVER database, ISQL and BCP commands, but it's all done on the SQL end. I want to see if it can be done on the .NET end of things using automation.

I'm quite sure it can be done, since you can walk through rows, I just need to know where to start.

Thanks
Petey

Setting Variable Column Widths At Design Time
Trying to set column widths of a datagrip to different sizes at design. Able to set all columns to a certain width but would like to be able to vary the columns in the grid. HELP!!

Setting Listview Listindex
Im always forgetting how to do this. How do i set my listindex of my listview to say row 6 (not selected just set the index) Thankx

Setting Up A ListView Control
I am new to working with the ListView control. The following works OK

Code:
'Create Column Headers
Dim Title As ColumnHeader
ColWidth = ListView1.Width / 5
Set Title = ListView1.ColumnHeaders.Add(, , "TextHere", ColWidth)


Now I want to add text to the first column, first row. I tried:

Code:
Set ListItem = ListView1.ListItems.Add(, , "NewText")


For some reason it didn't work - no text is entered into the control. What am I missing?

Also, how can I set the text of the column headers and the List Items to bold?

Listview With Column???
can i find a kind of list box where i can add columns!
i have heard a so called listview control could do this!
if yes where can i find it?
i mean how can i add it to the users interface?

Listview Second Column .....
Dear Friends!

I have two columns in a ListView (1) Account Number & 2) Customer Name. When I enter Customer Name in a msgbox it should search in the listview and highlight the row related to that customer. So, how can I modify the following code to get the result? (Customer Name is the second item in the listview): The code below works fine with the First Column "Account Number". I need it with second column "Customer Name".


Code:
Private Sub cmdSearch_Click()

Dim SearchString As String

Dim lngIndex As Long

SearchString = InputBox("Enter Customer name to search ...", "Search", "Enter Customer Name", 5650, 4900)

With ListView1
For lngIndex = 1 To .ListItems.Count
If InStr(1, .ListItems(lngIndex).Text, SearchString, vbTextCompare) Then
.ListItems(lngIndex).Selected = True
.ListItems(lngIndex).EnsureVisible
End If

Next
End With

End Sub


Thanks in advance.

Vblearner6

Listview 2nd Column
I have two colums in a listview and in the second is a bunch of different items containing numbers. i want to add them all up and display them, but it appends them instead of summing them.

Listview Second Column
I need help. I have a listview with two colums. First column has file names, second has size of that file. I want to double click a file in the first column, then the size of that item appears in a caption or something.

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