Hello,
I have a Listview control which displays various data.
The default selected item is the first item.
(Is it always the first item?)
Here's a simple code: - Dim objListItem As Object
-
-
lstvwXclList.View = lvwReport
-
' Set column headers
-
With lstvwXclList.ColumnHeaders
-
.Add , , "Activity", 4000
-
.Add , , "Description", 4700, lvwColumnLeft
-
.Add , , "Filename", 2400, lvwColumnRight
-
End With
-
-
Set objListItem = lstvwXclList.ListItems.Add()
-
objListItem.Text = "Swimming"
-
objListItem.SubItems(1) = "400 m Freestyle"
-
objListItem.SubItems(2) = "Swimming.xls"
The only clickable column is the first column.
In this case, the "Activity" column.
The problem here is the data in "Activity" column is editable.
The data need not to be edited. It must stay as is.
What to do in order to set it un-editable?
Haven't found any settings in the control's properties.
Help from the experts and the knowledgable are greatly appreciated.
10 10304 NeoPa 32,556
Expert Mod 16PB
What types of objects are you using? A ListBox control on a Form?
Juast subscribing for now. Is all the data for the ListView Control going to be Manually or Dynamically added, and if Dynamically, what is the Data Source?
NeoPa 32,556
Expert Mod 16PB
Right, so there is a ListView control available. I found it after hunting through the Additional Controls list. This would be found on a Form object for anyone who is not familiar with all the various objects available within Additional Controls.
As this is not something I'm familiar with I will simply watch with interest.
I took the liberty of revising your code, which should now work as originally intended. Let me know how you make out: - Dim itmX As ListItem
-
-
'Make sure ListView control is in report view.
-
Me![lstvwXclList].View = lvwReport
-
-
With Me![lstvwXclList]
-
'Add three columns (index, key, text, width, alignment, icon)
-
.ColumnHeaders.Add , "Activity", "Activity", 4000, lvwColumnLeft
-
.ColumnHeaders.Add , "Description", "Description", 4700, lvwColumnLeft
-
.ColumnHeaders.Add , "Filename", "Filename", 2400, lvwColumnRight
-
End With
-
-
'Add Activitys to column 1 (index, key, text, icon, smallicon)
-
Set itmX = Me![lstvwXclList].ListItems.Add(1, "Swimming", "Swimming") 'C1R1
-
' Use the SubItemIndex to associate the SubItem with the correct
-
' ColumnHeader. Use the key ("Description") to specify the right
-
' ColumnHeader.
-
itmX.SubItems(Me![lstvwXclList].ColumnHeaders("Description").SubItemIndex) _
-
= "400 m Freestyle"
-
' Use the ColumnHeader key to associate the SubItems string
-
' with the correct ColumnHeader.
-
itmX.SubItems(Me![lstvwXclList].ColumnHeaders("Filename").SubItemIndex) _
-
= "Swimming.xls"
-
-
'User cannot Edit Labels
-
Me![lstvwXclList].LabelEdit = lvwManual
P.S. - If you so desire, I can also Attach the Test Database used for this Thread, just let me know.
I took the liberty of revising your code, which should now work as originally intended. Let me know how you make out: - Dim itmX As ListItem
-
-
'Make sure ListView control is in report view.
-
Me![lstvwXclList].View = lvwReport
-
-
With Me![lstvwXclList]
-
'Add three columns (index, key, text, width, alignment, icon)
-
.ColumnHeaders.Add , "Activity", "Activity", 4000, lvwColumnLeft
-
.ColumnHeaders.Add , "Description", "Description", 4700, lvwColumnLeft
-
.ColumnHeaders.Add , "Filename", "Filename", 2400, lvwColumnRight
-
End With
-
-
'Add Activitys to column 1 (index, key, text, icon, smallicon)
-
Set itmX = Me![lstvwXclList].ListItems.Add(1, "Swimming", "Swimming") 'C1R1
-
' Use the SubItemIndex to associate the SubItem with the correct
-
' ColumnHeader. Use the key ("Description") to specify the right
-
' ColumnHeader.
-
itmX.SubItems(Me![lstvwXclList].ColumnHeaders("Description").SubItemIndex) _
-
= "400 m Freestyle"
-
' Use the ColumnHeader key to associate the SubItems string
-
' with the correct ColumnHeader.
-
itmX.SubItems(Me![lstvwXclList].ColumnHeaders("Filename").SubItemIndex) _
-
= "Swimming.xls"
-
-
'User cannot Edit Labels
-
Me![lstvwXclList].LabelEdit = lvwManual
P.S. - If you so desire, I can also Attach the Test Database used for this Thread, just let me know.
Sorry...it took me so long to reply.
This is what makes it work: Me![lstvwXclList].LabelEdit = lvwManual
Now, it is un-editable. =)
Changing the LabelEdit property in VB Editor seems
to be not working. No matter what value I set, it always
reverts to its original value. (Could it be a bug?)
Anyway, this issue is considered SOLVED.
Thanks to NeoPa and ADezii!
(...for their time and effort)
You both did help another one here. =D
....
Changing the LabelEdit property in VB Editor seems
to be not working. No matter what value I set, it always
reverts to its original value. (Could it be a bug?)
....
I now know why setting the properties of ListView control in
VB Editor doesn't work. It is because the ListView has its own
"Property" setting.
The pre-defined Property Setting link is the "Properties".
But the ListView's link is "ListViewCtrl Object".
Please refer to attached image.
No wonder why my settings were not reflected.
Weirdness of the ListView Property Setting solved.
(Signing off)
I now know why setting the properties of ListView control in
VB Editor doesn't work. It is because the ListView has its own
"Property" setting.
The pre-defined Property Setting link is the "Properties".
But the ListView's link is "ListViewCtrl Object".
Please refer to attached image.
No wonder why my settings were not reflected.
Weirdness of the ListView Property Setting solved.
(Signing off)
ListViewCtrl is the ActiveX Control's OLE Class Name, you should still be able to modify the LabelEdit Property programmatically in the manner in which I have described, and what I have been successful doing. Oh well, as long as it works it will have to remain a mystery - ActiveX Controls are funny that way! (LOL)!
NeoPa 32,556
Expert Mod 16PB
Keirnus, you're welcome to what little assistance I was able to provide on this one.
May I also say that we appreciate your updating the thread with your new understanding of the matter. I expect this will be quite useful for those coming after us :)
ListViewCtrl is the ActiveX Control's OLE Class Name, you should still be able to modify the LabelEdit Property programmatically in the manner in which I have described, and what I have been successful doing. Oh well, as long as it works it will have to remain a mystery - ActiveX Controls are funny that way! (LOL)!
Yes, it can be modified programatically.
It is what I am implementing now.
That's to make sure it has the right property setting
even if somebody's gonna change it in VB Editor.
Yes, it can be modified programatically.
It is what I am implementing now.
That's to make sure it has the right property setting
even if somebody's gonna change it in VB Editor.
You can also Password Protect the code in the VB Editor Window if you so desire.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Agathe |
last post by:
Bonjour,
Je souhaite insérer dans une table MySQL des données provenant d'un fichier
texte grâce à un script PHP. Mon fichier porte l'extension "txt" et les
données sont séparées par des ";'.
...
|
by: Raymond H. |
last post by:
Bonjour,
Je n'arrive pas à savoir comment lire via vb4 l'adresse d'un favoris
dans le dossier des favoris où Internet Explorer place ses favoris.
Par exemple, comment fait-on pour afficher l'url...
|
by: Mauro |
last post by:
Ciao a tutti!
vorrei sapere se qualcuno potrebbe darmi qualche dritta (o se sa dove
reperire un tutorial) su come realizzare un trial a tempo, da
integrare ad un mio programma per impedirne...
|
by: richard |
last post by:
bonjour
je me connecte à une base de données interbase/firebird en utilisant,
KinterbasDB
http://kinterbasdb.sourceforge.net/ pour ceux que ca interesse
mais je pense que le probleme est le...
|
by: pascal Joseph |
last post by:
J'ai un formulaire avec un seul champ text appelé "unite" et un
bouton.
En javascript j'aimerai utiliser un script qui interdise les valeurs
de type "char" et soit supérieur à 0
J'ai trouvé...
|
by: Chris |
last post by:
Bonjour,
Plusieurs fichiers PHP d'un programme open source de compteur de visites
viennent de se faire hacker sur mon serveur (hébergement mutualisé chez un
fournisseur d'accès). Le hacker a...
|
by: Jorge Gallardo |
last post by:
Hola de nuevo a todos...
Agradecido a todos los que me habeis solucionado problemas anteriores...
Pero como no es novedad, me surge otro.
Recientemente buscando, adquiri un codigo para juntar...
|
by: Alex |
last post by:
Ciao a tutti,
sto sviluppando un applicazione windows, in breve all'interno dello
stesso namespace ho un form con una datagrid e un thread che effettua
dei controlli e "dovrebbe" caricare i dati...
|
by: Ciudad Tecnópolis |
last post by:
Hola, primero que todo mil disculpas por postear una pregunta no relacionada
al tema pero se que será muy útil para todos!
Actualmente estoy presentando un desarrollo en .NET para una compañía y...
|
by: nano9 |
last post by:
Hola gente quisiera que alguien me pudiera ayudar con un problemilla
que tengo, resulta que estoy programando en ASP con C# y estoy usando
un cadbgrid que se comporta parecido a un datagrid o...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |