[Read] Need Help With Custom Scrollbars On A Listview Control! Or Skinning Listview..
I have been searching for weeks now to find a way to use a custom scrollbar to scroll a listview...
Like this:
Now I use an alternating BG function on my listview and I am currently using the ensurevisible method of scrolling a listview...
Is there a better way?
I will post some example projects if needed...
But how would I use a custom scrollbar on a listview control
Thanks for helping
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listview Scrolling With Custom Scrollbar Activex Control... Please Read!
I am in dire need of a extremely good way of using the Microsoft listview control with a custom made scrollbar that has the same properties as the regular VScroll that is built into VB6 (Max, Min, Value, etc)...
Now I have done a ton of searching around and I cant seem to find a good way of doing this that is just has good as the regular scrollbar that is built into the listview... I dont want my users to notice a difference in how the feel, just how they look...
Anyway, I have a custom control I write that functions as a scrollbar, and works quite well...
Now let me also tell you I am using the alternating background function that is available from the code bank I believe... if not here it is:
Code:
Public Sub AltLVBackground(LV As ListView, _
ByVal BackColorOne As OLE_COLOR, _
ByVal BackColorTwo As OLE_COLOR, _
frm As Form)
Dim lH As Long
Dim lSM As Byte
Dim picAlt As PictureBox
With LV
If .View = lvwReport And .ListItems.Count Then
Set picAlt = frm.Controls.Add("VB.PictureBox", "picAlt")
lSM = .Parent.ScaleMode
.Parent.ScaleMode = vbTwips
.PictureAlignment = lvwTile
lH = .ListItems(1).Height
With picAlt
.BackColor = BackColorOne
.AutoRedraw = True
.Height = lH * 2
.BorderStyle = 0
.Width = 10 * Screen.TwipsPerPixelX
picAlt.Line (0, lH)-(.ScaleWidth, lH * 2), BackColorTwo, BF
Set LV.Picture = .Image
End With
Set picAlt = Nothing
frm.Controls.Remove "picAlt"
LV.Parent.ScaleMode = lSM
End If
End With
End Sub
When I use a function like this to scroll:
Code:
Public Sub ScrollListView(lst As ListView, ByVal Shift As Long)
If Shift < 1 Then
lst.ListItems(1).EnsureVisible
ElseIf Shift > lst.ListItems.Count Then
lst.ListItems(lst.ListItems.Count).EnsureVisible
Else
lst.ListItems(Shift).EnsureVisible
End If
End Sub
The user can see a big difference between how the normal scrollbar functions and the custom scrollbar, because the data lags as the image behind it is being moved... this is my theory...
Because when I dont add the alt bg it scrolls fine...
and when the listview is populated I just set the total items to the max of the scrollbar, and on the scroll event call
Code:
ScrollListView myList, scroller.value
and that works fine, but when I have the alt bg it messes up...
So I need a pure api method of doing the same above that will give me crystal clear results and look and act like I am scrolling the listview with the normal scrollbars that microsoft implemented
Thanks,
Vbman213
Challenge - ListView With Custom Scrollbars
Challenge - ListView with Custom Scrollbars
Is anybody smart enough to help me get this working ok? I cannot make that the scrollbar reachs the bottom at the same time as the ListView. It's still buggy.... who dare see it?
Scrollbars On A Listview Control
I have a listview control which gets it's data from a database. Once the list gets too long the scroll bars auto appear. This is ok except for the horizontal scrollbar. There doesnt' need to be one because i have resized the listview's width to more than fit the contents.
Is there anyway to "hide" the horizontal scrollbars on a listview?
thanks
Listview And Scrollbars
The question is prety simple, but I don't know if the answer will be.
Is it possible to show the vertical scrollbar of a listview even when there is only one Item or even no items in the listview??
No Scrollbars On My Listview
Ive got this listview control on a form, (VB 6) the columns are wider than the control (report view) but no scrollbars are appearing! anyone any ideas? ive looked through the properties and there's nothing
thanks
Listview ScrollBars??!!
yes, i have a listview where you can add icons/items and remove them if you are wanting...but when i have alot of items inside my listview all at once most of them will go out of view and you would need a scroll bar to scroll along to see the ones not in view...but no scroll bars appear at all? how do i get a vertical and hornizontal scrollbar in my list view??....
Thank you.
Listview's Scrollbars?
How can I detect if a listviews vertical scrollbar is visible or not? API or standard code would be excellent...
Oooo...999th post
ListView...scrollbars...
is it possible to detect, using API or otherwise, is a listview has a vertical scroll bar showing?
Basically what I want to do is resize the columns so that the horizontal scroll bar doesn't appear! But if the vertical one appears then the horozontal one also appears due the the vertical scroll bar taking up some room on the listview...
Detect Listview Scrollbars
I'm using listview (Report view) to list an unknown number of items. Depending on the number of items, the listview may or may not have a vertical scrollbar.
Is there a way to check whether a scrollbar is shown, so that I can adjust the column widths accordingly (to avoid a horizontal scrollbar)? Or would I have to count the number of items, and then calculate whether they fit into the listview without scrolling or not?
ListView.... And Flat Scrollbars...
Hi
Ok this is the last time I ever used the listview... it only gives me ****... LOL
Anyway... what's up with the flat scrollbars in a listview.
I have VB6 and they made it as a property... but that doesn't work...
I tried Chris his flat scrollbar sendmessage, but that doesn't work either...
I have the right dll, so that shouldn't be a problem... (and the flatheader works fine :-)
Do I overlook something? Hope anyone knows how to solve...
tnx in advance
Crazy D :-)
Listview And Vertical Scrollbars
I am manually populating a Listview, and when the item exceed the height of the ListView the vertical scroll bar appears. As you continue to add more items the scroll bar will not show the last-bottom item (the last item you just entered).
Does any one know how to make the scroll go to the bottom? Or the last item?
I am using VB6 SP5
The ListView has the Icon view.
Thanks in advance.
Brand Newbie - ListView Scrollbars
Post Number One!
Hi gang!
Firstly - Nice place you have here! Mind if I hang out a bit?
Secondly - I need some input on a "problem" I've just experienced. I'm rather new at VB but have put together what seems to be an extensive program for databasing AutoCAD drawings.
My problem: I am displaying a 2-column "Listview" of AutoCAD drawing (.DWG) file information. I get the first filename and put it into the 1st column. Then I go to a database to find the filename's drawing title and put that into the second column. All of that works fine, but I do not get a vertical scrollbar when the number of records exceeds the height of my listview box. The code is in my Userform "Initialize" subroutine and is as follows:
Code:
Fname = Dir(WorkingPath & "*.DWG") ' verify 1st filename
ListView1.View = lvwReport
ListView1.Height = 440
ListView1.Width = 787.9
ListView1.HideColumnHeaders = False
ListView1.GridLines = True
ListView1.GetFirstVisible
ListView1.ColumnHeaders.Add Text:="PROJECT FILE NAME"
ListView1.ColumnHeaders.Item(1).Width = 166
ListView1.ColumnHeaders.Add Text:="DRAWING TITLE"
ListView1.ColumnHeaders.Item(2).Width = 618
ListView1.Sorted = True
Conn.Open ("provider = (yadda-yadda-yadda)")
StrQuery = "SELECT * FROM PROJECTFILES"
RS.Open StrQuery, Conn, adOpenKeyset, adLockOptimistic
Do While Fname <> ""
-
- Section of script where I search title records for
- the drawing filename
-
Set oListItem = UserForm2.ListView1.ListItems.Add()
oListItem = Left(Fname, Len(Fname) - 4)
oListItem.SubItems(1) = FullDwgTitle
Fname = Dir ' Assign next filename
Loop ' look for next filename
RS.Close
Conn.Close
ListView1.Refresh
As stated, everything "lists" just fine except that I'm missing the vertical scrollbars on long lists. I can maneuver up and down by using the keyboard, but having a scrollbar would be convenient. Any suggestions/comments are appreciated, thanks!
Listview (report View) Scrollbars
I can't seem to figure this out: how do I add vertical and horizontal scroll bars to a Listview control with its "View" property set to "lvwReport"? I have tried many thing ... but none seem to work.
Custom Listview
How would i start making a custom listview so that it supports different fonts on each item.
i.e
Listview item 1
Listview item 1
Custom ListView (or ?)
Is there a Custom ListView control (or alternative?) where you can have icons and a description + more beneath them?
Like this:
Code:
<icon picture>
Name: Item1
Item1 Description
Is it possible? Or is there an alternative control (or 3rd party control) available anywhere?
ListView Custom Draw
has anyone seen this ListView Custom Draw code from Brad Martinez of
http://btmtz.mvps.org/
and the code itself -
http://btmtz.mvps.org/listview/lvcustomdraw.zip
after i have Start a New Project - Add Form and the required controls that is the Microsoft Windows Common Controls 5.0 that was used in the initial project.
so i have this problem when i run the code
VB Code:
lvcd As NMLVCUSTOMDRAW 'this was highlighted
User-defined type not defined.
can anyone help?
my example is in the attachment below
thanks in advance...
Custom Members In ListView
Is there any way I could "add" custom "types" to an item in ListView? For example, you have Text, ToolTipText, TAG, etc.
Could you add a new value like "MyValue" so you could do:
ListView.ListItems.Item(x).MyValue = "blah"?
I just need to add several *MORE* values to each item in a list...
anyone have any ideas on this?
Thanks,
TD
Custom Scrollbar On ListView
Does anyone know how to change the appearance of the scrollbar in a listview. (ie. Assign pictures to the up/down arrows and slider etc.).
Twisted|Soul
Transcending even the highest forms of digital spirituality.
ListView With MultiSelect, Custom SelectionChange Event
Hi,
I've created a usercontrol, which contains a ListView object. I want my usercontrol to raise an event 'SelectionChange' when the selection in the listview changes. What is the neatest way to achieve this?
Raising the event in the ListView_ItemClick event is not an option, because it will raise the event for every ListItem that is selected (example: when I press SHIFT+END to select everything, and the ListView contains 1000 ListItems, the event will be raised 1000 times!)
Please help me!
ListView Custom Draw Doesn't Work With Container
Hi,
I've tried using custom draw (CDRF_NEWFONT...) when subclassing ListView to change row's backcolor... However, I noticed that this doesn't work if ListView is in a container (frame...) - the colors do not change...
Code:
' bas module code
' hook system and color the backcolor of rows different colors
' as with hooking if you unload using the stop button of Visual Basic
' and you don't use the unloadquerry (the X on the form)
' then windows will crash
'
Option Explicit
Public Const GWL_EXSTYLE = -20
Public Const GWL_HINSTANCE = -6
Public Const GWL_HWNDPARENT = -8
Public Const GWL_ID = -12
Public Const GWL_STYLE = -16
Public Const GWL_USERDATA = -21
Public Const GWL_WNDPROC = -4
Public Const DWL_DLGPROC = 4
Public Const DWL_MSGRESULT = 0
Public Const DWL_USER = 8
Public Const NM_CUSTOMDRAW = (-12&)
Public Const WM_NOTIFY As Long = &H4E&
Public Const CDDS_PREPAINT As Long = &H1&
Public Const CDRF_NOTIFYITEMDRAW As Long = &H20&
Public Const CDDS_ITEM As Long = &H10000
Public Const CDDS_ITEMPREPAINT As Long = CDDS_ITEM Or CDDS_PREPAINT
Public Const CDRF_NEWFONT As Long = &H2&
Public Type NMHDR
hWndFrom As Long ' Window handle of control sending message
idFrom As Long ' Identifier of control sending message
code As Long ' Specifies the notification code
End Type
' sub struct of the NMCUSTOMDRAW struct
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
' generic customdraw struct
Public Type NMCUSTOMDRAW
hdr As NMHDR
dwDrawStage As Long
hDC As Long
rc As RECT
dwItemSpec As Long
uItemState As Long
lItemlParam As Long
End Type
' listview specific customdraw struct
Public Type NMLVCUSTOMDRAW
nmcd As NMCUSTOMDRAW
clrText As Long
clrTextBk As Long
' if IE >= 4.0 this member of the struct can be used
'iSubItem As Integer
End Type
Public g_addProcOld As Long
Public g_MaxItems As Long
Public clr() As Long
Public Declare Function SetWindowLong Lib "user32.dll" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function CallWindowProc Lib "user32.dll" Alias _
"CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Public Function WindowProc(ByVal hWnd As Long, _
ByVal iMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case iMsg
Case WM_NOTIFY
Dim udtNMHDR As NMHDR
CopyMemory udtNMHDR, ByVal lParam, 12&
With udtNMHDR
If .code = NM_CUSTOMDRAW Then
Dim udtNMLVCUSTOMDRAW As NMLVCUSTOMDRAW
CopyMemory udtNMLVCUSTOMDRAW, ByVal lParam, Len(udtNMLVCUSTOMDRAW)
With udtNMLVCUSTOMDRAW.nmcd
Select Case .dwDrawStage
Case CDDS_PREPAINT
WindowProc = CDRF_NOTIFYITEMDRAW
Exit Function
Case CDDS_ITEMPREPAINT
If clr(.dwItemSpec) <> 0 Then
'change the color of the text display if wanted
'udtNMLVCUSTOMDRAW.clrText = vbBlue
udtNMLVCUSTOMDRAW.clrTextBk = clr(.dwItemSpec)
CopyMemory ByVal lParam, udtNMLVCUSTOMDRAW, Len(udtNMLVCUSTOMDRAW)
End If
WindowProc = CDRF_NEWFONT
Exit Function
End Select
End With
End If
End With
End Select
WindowProc = CallWindowProc(g_addProcOld, hWnd, iMsg, wParam, lParam)
End Function
Public Sub SetLIBackColor(lv As ListView, nitem As Integer, BkColor As Long)
clr(nitem - 1) = BkColor
lv.Refresh
End Sub
Public Sub SetLIForeColor(lv As ListView, ForeColor As Long)
clr(nitem - 1) = ForeColor
lv.Refresh
End Sub
'<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'
'Form Code.
Option Explicit
Private Sub Form_Load()
ListView1.FullRowSelect = True
ListView1.View = lvwReport
With ListView1
.ColumnHeaders.Add , , "Item Column"
.ColumnHeaders.Add , , "Subitem 1"
.ColumnHeaders.Add , , "Subitem 2"
Dim i&
For i = 1 To 30
With .ListItems.Add(, , "Item " & CStr(i))
.SubItems(1) = "Subitem 1"
.SubItems(2) = "Subitem 2"
End With
Next
End With
' Don't forget to redim array if you add/remove listview items
ReDim Preserve clr(ListView1.ListItems.Count)
g_MaxItems = ListView1.ListItems.Count - 1
g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Private Sub Command1_Click()
'set the rows to different colors
SetLIBackColor ListView1, 1, vbYellow
SetLIBackColor ListView1, 2, vbRed
SetLIBackColor ListView1, 3, vbMagenta
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SetWindowLong(hWnd, GWL_WNDPROC, g_addProcOld)
End Sub
Any ideas?
thanks,
Darko
Programically Scrolling Listview With API And Linking A Custom Scrollbar To It
Ok this is what I have going on
I have a listview that I have disabled the scrollbars to make room for my custom scrollbars....
I have already made them and they function just like the standard scroll bars in vb6
now I have done this with a textbox before and I had 4 functions made for it
Code:
Private Declare Function PutFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Private Declare Function SendMessageBynum Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_GETSEL = &HB0
Private Const EM_LINEFROMCHAR = &HC9
Public Function GetLineNumber(txtTextBox As TextBox) As Long
Dim lngSelectedText As Long
Dim lngLineNumber As Long
lngSelectedText = SendMessageBynum&(txtTextBox.hwnd, EM_GETSEL, 0, 0&)
lngLineNumber = SendMessageBynum(txtTextBox.hwnd, EM_LINEFROMCHAR, lngSelectedText, 0&)
GetLineNumber = lngLineNumber
End Function
Public Function GetNumberOfLines(txtTextBox As TextBox) As Long
Dim lngNumberOfLines As Long
lngNumberOfLines = SendMessageBynum(txtTextBox.hwnd, EM_GETLINECOUNT, 0, 0&)
GetNumberOfLines = lngNumberOfLines
End Function
Private Function ScrollText&(TextBox As Control, vLines As Integer)
Dim success As Long
Dim SavedWnd As Long
Dim Lines As Long
Dim R As Long
Const EM_LINESCROLL = &HB6
Lines = vLines
success = SendMessage(TextBox.hwnd, EM_LINESCROLL, 0, Lines&)
R = PutFocus(SavedWnd)
ScrollText& = success
End Function
how would I do the same thing for a listview control
Custom Button On Programed Skined Form (not Using A Skinning App, Just VB)
Ok well since there are some skinning programs out there that are to hard to use (I’m kinda new at this/self taught) I decided to make my own program independent of skinners that is skinned, now I’m able to get transparencies, but I’m having trouble with buttons, I want the button to have a normal, over, and down state. Instead of using a command button I used and image box.
This is what I managed; This code seems to have a bug where the mouse is over button 1 and changes to its over image, then when you move your mouse over the next button it also changes to its over image, but button 1 doesn’t change back to its normal image, I’ve tried to program it so that the buttons will change to their normal images when the mouse is over the form but then I got this annoying flickering of the images, so I added the variable pressed as a Boolean and that’s where the problem has occurred, but the flickering stoped. All of the MouseMove(blah blah blah) functions make the images flicker (since its changing the image all the time)
Can anyone help me find any solution to this bug and the flickering, different code perhaps? I could get rid off the over state of the buttons, but I’d rather keep them if I could. I’ve attached a simple skinned program with 2 buttons and the code, pics and a project1.exe
I hope someone can help me
Btw I used the transparency form creator from plant source code
Code:Option Explicit
Public Over As Boolean
Public Pressed As Boolean
Public Path As String
'___________________________________________________
Private Sub Form_Load()
Dim rgnMain As Long
Path = App.Path
End Sub
'___________________________________________________
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Pressed = True Then
Image1.Picture = LoadPicture(Path & "NormalAkuma.gif")
Image2.Picture = LoadPicture(Path & "NormalRyu.gif")
Pressed = False
End If
End Sub
'___________________________________________________
Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Pressed = False Then
Image2.Picture = LoadPicture(Path & "OverRyu.gif")
Over = True
Else
Image2.Picture = LoadPicture(Path & "DownRyu.gif")
End If
End Sub
'___________________________________________________
Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.Picture = LoadPicture(Path & "NormalRyu.gif")
End Sub
'___________________________________________________
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.Picture = LoadPicture(Path & "DownRyu.gif")
Pressed = True
MsgBox ("You have pressed Ryu")
End Sub
'___________________________________________________
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Pressed = False Then
Image1.Picture = LoadPicture(Path & "OverAkuma.gif")
Over = True
Else
Image1.Picture = LoadPicture(Path & "DownAkuma.gif")
End If
End Sub
'___________________________________________________
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(Path & "NormalAkuma.gif")
End Sub
'___________________________________________________
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(Path & "DownAkuma.gif")
Pressed = True
MsgBox ("You have pressed Akuma")
End Sub
Signature -----------------------------------------------------------------------------------------------------Code:Private Sub Form_Load() 'Print to from, code my problems!
Form1.Print "CanT SleeP!..... MusT PrograM!!!" & vbCrLf & "I need coffee, WhErE iS mY CoFfEe?!"
End Sub 'All things come to and end
------------------------------------------------------------------------------------------------------------------
Edited by - coma on 7/29/2004 8:13:57 PM
Please Read! Need Help With Custom Scrollbar Control!
I am working on a simple custom scrollbar and I am having some problems...
Download the attached project below
My problem is with the algorithm that calculates the value...
Some of this code I found on the net, but I have modified it to meet my needs, except I have some problems...
The value calculates wrong, since I added the buttons...
it basically needs a more firm algorithm... and I really need some help...
Help is much appreciated...
Thanks in advance
-Vbman213
Listview To Read Xml
Hi guys
please can you advise me how I could make a listview to read the xml file through on my web hosting??
As I am planning to make a p2p software of my own to updates the tv channels, if there is possible to make one like this....
Please could you let me know, also I would like to adds the images of myself at the very far left next to the name of the channels.
Just something to get me started with will be aprecciated.
Thanks
Listview To Read Xml
Hi guys
I am new on this forum, please can someone advise me how I could make a listview to read the xml file through on my web hosting??
As I am planning to make a p2p software of my own to updates the tv channels, if there is possible to make one like this....
http img54.imageshack.us/img54/6262/examplelistviewkh4.png
Please could you let me know, also I would like to adds the images of myself at the very far left next to the name of the channels.
Just something to get me started with will be aprecciated.
Thanks
Read Values From A Listview
Hello,
I'm new to this forum so I hope its in the correct category
Now the problem. I have a listview in my form with 3 collums (Nr - Name - Type) and an unknown number of row. When i select a row, i want to read the value of the Nr collum.
To make a long story short: I have figured our how to add items in the listview, but i don't know how to read them
It's my first year programming at high-school so my knowlege isn't that big...
Thnx in advance
Freak
PS: we are using VB.NET
How To Read Data From A ListView
Hi There,
This is the scenario.
I have some data and I am populating the data to a ListView after doing some changes. I am doing this by using the .ListItems.add and .ListSubItems.Add. The code is as follows
Dim FirstStorecol as ListItem
Dim NextStoreCol as ListSubItem
set FirstStorecol = lvSelStores.ListItems.Add(, , StoreNo)
set NextStoreCol = FirstStorecol.ListSubItems.Add(, , Address)
set NextStoreCol = FirstStorecol.ListSubItems.Add(, , City)
Well I am able to see the data in the listbox. My problem is to read this data from the ListView as a whole and save that to another table. I can use the ListView.count to find the no of items in the ListView, But I want to read the whole data in the ListView and save it to a table.
Actually I would like to read only the first column data ie StoreNo, no need to read the listviews subitems. Only the first column data is required. What all data are there in the first column, I should be able to read and save that into a table. For eg if the ListView has 10 values under the StoreNo Column I should be able to read all these and save that to a table with StoreNo as a field. All the other columns in the ListView are for display purpose only.
I would really appreciate your help if somebody was able to give me some advice or suggestions or even code for the above matter.
Thanking You in Advance
Dipu Thomas
Usercontrol--Custom Textbox Control--read Only Properties
I'm writing my own little "extensions" for a standard vb textbox control. I guess technically it's an "extended" control----
Anyway--
In the usercontrol I have everythying like I want it cept for one thing. It's telling me the multiline and scrollbox properties for my textbox are read only and I can't change them. By changing them, I'm referrring to actually trying to changed the exposed properties of the control via property browser or code for an instantiated control (read: one that's on a form, not the usercontrol window, as now it's just in a test project before I make it an ocx)
I thought this was something that was covered by using the usercontrol.ambient property, but that didn't work either (maybe not using it right). What's the workaround?
All I have control wise on the usercontrol is a textbox. Most of the events for the usercontrol are handled by the textbox, but not all of them, as some of them are custom events.
I know there has to be a better solution then adding two textboxes, one multiline and one not.
Thanks for your help,
Calpha
Can We Read The Items In A Listview To An Array???
hey guys,
Thanks for all your help till now and for the future.
This time, I am planning to do a binary search for a group of items that is shown in a list view. I have around 60 items under different headers.
I know how to o a binary search, but I just need to first "sort" the items as you know, a binary search can only be done in an arranged list of items. I know how to do the sorting. All I need is as I said before is knowledge of how to read the items into an array???
Any Ideas????
Thanx
darkshade
How Do I Read Subitems When Looping In A Listview??
Can someone show me an example code of how to loop through all of the items in a listview including the subitems? I got the items but do not know how to read the subitems without selecting them with the mouse first.
I did this so far:
For i = 1 To listview1.ListItems.Count
MsgBox listview1.ListItems.Item(i)
Next
How do I get the subitems for each listitem as I loop above? I need to assign them to string variables.
Thanks for your help!!!
Listview And Read All Types Of Files
I have three textboxes,one Command Button,DbGrid, and a Listview in my program. The purpose of this form is to capture a new record which has one to many relationship(Building->Apt).
1)
My Listview has three columns and many rows. User can enter new records using the three textboxes and the Add command button. My problem is how to update the Listview. For instance go to a record in the third row and change something.Any ideas??
(I have not save the record yet).
2)
I am attaching .Doc/Xls/Txt/Rtf files into DBGrid. So user can open(double clicking the row) and edit the documents.It is working. Now user wants to attach any type of files; specially PDF and Word Perfect files. What is the best way to solve this problem? I am using Dialogbox Control.
Thanks
Very Good Hint (read If You Use Listview With Many Items)
This is just a performance hint i'd like to share with you Came to stumble on this myself since i've been working much with presentation of large ammounts of data in listviews - both from MsAccess, MySQL, and XML sources. The key point is: If you push items into a listview, it will take time. There are a few ways to get past this:
1. Sorting
If you use sorting in your listview, turn it off while inserting the items. This will give a huge boost actually
Code:
lvwMyListview.Sorted = False
(...populate...)
lvwMyListview.Sorted = True
2a. Disable update
Read on microsoft site for more insight into this method - http://msdn.microsoft.com/library/en...asp?frame=true
Code:
Private Declare Function LockWindowUpdate Lib "User" (ByVal hWndLock As Integer) As Integer
LockWindowUpdate lvwMyListView.hWnd
(...populate...)
LockWindowUpdate 0
lvwMyListView.Refresh
If you want to stay at the safe side, issue the lockwindowupdate call before adding each line - this will make sure that your listview stays locked at all costs
2b. Disabling update (another way)
According to http://www.mvps.org/vbvision/visual_basic_tips.htm:
MS does not recommend the use of the LockWindowUpdate API function for preventing drawing to a specific window while multiple updates are occurring. The preferred method is to use the the SendMessage API function along with the WM_SETREDRAW constant passing the hWnd of the specific window that should not be redrawn.
And here is the code for that one as well:
Code:
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Private Const WM_SETREDRAW = &HB
SendMessage lvwMyListView.hWnd,WM_SETREDRAW,False,0
(...populate...)
SendMessage lvwMyListView.hWnd,WM_SETREDRAW,True,0
lvwMyListView.Refresh
There might be a ByVal or two needed in the above code, i'm at work atm so i don't got any chance to try it out. I just thought i'd share this with you
Ah, also, i've used the LockWindowUpdate function without running into any problem. I guess why MS recommends away from using it is that only window can be locked at a time... Don't know if that is on system level or app level. If you wanna be sure that it works, either do a LockWindowUpdate in ever call, or use the sendmessage method
Hope you find this useful!
Regards,
Christopher
Help: How To Read Excel And Load Data To Listview?
Hello I've been searching the forums about how to read an excel file and load the data into a listview. What I got from the forum is how to load data from a listview into excel.
What I have in mind is to select an excel file using a common dialog control and loads the data into a listview.
The excel file is actually preformatted already. It has fixed fields and only has 1 sheet.
Is it possible to just get the data from the excel file without opening excel?
These are the fields in the excel file:
1.TransNo
2.CustNo
3.Payment
4.Date
If you can point me to a link I would be very happy. Any help/suggestion will be highly appreciated.
Needs Listview Sample To Read Item Data On Xml Doc
hi guys
I just needs your help with my client, I couldn't find a listview to read the items data on xml document. It's like this one what i wish to put on my program.......
Please if you could help me out to find the sample one which it will be great while I can adds the item data on the xml document???
Thanks in advance!
Custom Scrollbars Like IE ?
does anyone know of a custom control(s) that have vertical / horizontal scrollbars like IE does ? (in the sense that there is like 12 color settings for the scrollbar)
Custom Scrollbars
Is there any way to change the type of scrollbar used in a textbox from that ugly grey square thing to something custom??
Custom Scrollbars
Is there any way to change the type of scrollbar used in a textbox from that ugly grey square thing to something custom??
Read Text File And Display In Listview Report Style
I run a command netstat -a > text.txt
and get the result as below:
Active Connections
Proto Local Address Foreign Address State
TCP p2:1030 P2:0 LISTENING
TCP p2:80 P2:0 LISTENING
TCP p2:135 P2:0 LISTENING
TCP p2:6543 P2:0 LISTENING
TCP p2:443 P2:0 LISTENING
TCP p2:1032 P2:0 LISTENING
TCP p2:1032 APIITNT:nbsession ESTABLISHED
TCP p2:137 P2:0 LISTENING
TCP p2:138 P2:0 LISTENING
TCP p2:nbsession P2:0 LISTENING
TCP p2:1028 P2:0 LISTENING
TCP p2:1029 P2:0 LISTENING
TCP p2:1031 P2:0 LISTENING
UDP p2:6543 *:*
UDP p2:nbname *:*
UDP p2:nbdatagram *:*
Now I want write a porgram to read the test.txt and
display in a listview with four column, which is same with above.
How can I display the result?
Can anyone help me???
thanks
Custom Listbox Scrollbars
is it possible to change the default windows scrollbar within the listbox control, because the grey 3D one doesnt suit my interface, any help?
2 ListView Questions. 1 About Selecting Records. 2 About Adjusting Listview Box Size.
Hi,
I'm changing some of my programs to use a ListView instead of a ListBox.
1. On selecting a record how do I pass the info from the fifth column to another Sub? (I have .FullRowSelect = True)
2. I'm dynamically adjusting the column widths to the maximum length of the data going into the column. Is there a way to dynamically adjust the width of the listview box itself to be the sum of the column widths?
Thanks,
Al.
Custom Scrollbars - Image Included
OK, before I get into the nitty gritty of my question, here's a screenshot comparing my playlists scrollbar to that of winamp's:
http://www.tearsforfreedom.com/scrollbars.gif
Now, i've searched up and down for tutorials on how to do this and have found nothing. My question is, how can I make a custom scrollbar for my listbox? I know that i'll need 3 images for sure (up arrow, down arrow, and the scroller thingy in the middle), but the question is, how do I get those to relate to my listbox so that when they are clicked, they scroll the listbox as well as itself? If anyone can point me in the right direction, i'd greatly appreciate. Thanks in advance.
How To Compare 2 Listviews And Copy Listview Content To Another Listview?
Hi all. I am filling a listview with xml data as shown in code beleow. I am calling this part using timer.What i want at the end of this code to compare listview1 with listview2. If they are diffrent or if listview2 is empty then i copy content of listview1 to listview 2.Otherwise do nothing. could any one show me how i can make such compare an copy?Thanks
1 Code:
Dim objDoc As MSXML2.DOMDocument
Dim objNodelist As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim lvwItem As ListItem
'load the xml document
Set objDoc = New MSXML2.DOMDocument
objDoc.async = False
objDoc.Load "http://localhost/data.php"
'add all the song nodes into a nodelist
Set objNodelist = objDoc.selectNodes("//song")
'Clear the listview
ListView1.ListItems.Clear
'Loop through each song node and add to the list view
For Each objNode In objNodelist
Set lvwItem = ListView1.ListItems.Add(, , objNode.selectSingleNode("artist").Text)
lvwItem.SubItems(1) = objNode.selectSingleNode("name").Text
lvwItem.SubItems(2) = objNode.selectSingleNode("image").Text
lvwItem.SubItems(3) = objNode.selectSingleNode("rating").Text
lvwItem.SubItems(4) = objNode.selectSingleNode("songid").Text
lvwItem.SubItems(5) = objNode.selectSingleNode("totalvotes").Text
Next objNode
''Here i want to compare listview1 with listview2. If it is empty or diffrent if fill it
otherwise i do nothing.
Set lvwItem = Nothing
Set objNodelist = Nothing
Set objDoc = Nothing
|