Click here to Skip to main content
15,910,787 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
castingflame3-Feb-10 7:01
castingflame3-Feb-10 7:01 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
Paul Roseby3-Feb-10 10:25
Paul Roseby3-Feb-10 10:25 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
Paul Roseby3-Feb-10 10:28
Paul Roseby3-Feb-10 10:28 
QuestionListView: How to link columnheader into subitem Pin
jtpaa2-Feb-10 23:44
jtpaa2-Feb-10 23:44 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 0:41
professionalDaveAuld3-Feb-10 0:41 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 1:06
professionalDaveAuld3-Feb-10 1:06 
GeneralRe: ListView: How to link columnheader into subitem Pin
jtpaa3-Feb-10 1:29
jtpaa3-Feb-10 1:29 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 2:31
professionalDaveAuld3-Feb-10 2:31 
There does not appear to be anywayto map the subitems to columns.

However this IS doable using the width. refere back to the orginal form example i gave earlier and add the code below;
You will see, when you remove a column its width is set to 0 and added to a list of locked columns, then when the user tries to resize the locked column the columnresizing event checks if the column is in the locked collection, cancel the event and sets the width to 0.

Public Class Form1

    Dim listLocked As New List(Of Integer) 'Locked columns

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Add some columns
        ListView1.Columns.Add("Col 1")
        ListView1.Columns.Add("Col 2")
        ListView1.Columns.Add("Col 3")
        ListView1.Columns.Add("Col 4")

        'Add some test data
        Dim x As New ListViewItem
        x.Text = "1"
        x.SubItems.Add("2")
        x.SubItems.Add("3")
        x.SubItems.Add("4")
        ListView1.Items.Add(x)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim colIndex As Integer = 2
        ListView1.Columns(colIndex).Width = 0
        If Not listLocked.Contains(colIndex) Then listLocked.Add(colIndex)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim colIndex As Integer = 2
        ListView1.Columns(colIndex).Width = 25
        If listLocked.Contains(colIndex) Then listLocked.Remove(colIndex)
    End Sub


    Private Sub ListView1_ColumnWidthChanging(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnWidthChangingEventArgs) Handles ListView1.ColumnWidthChanging
        'Check column is not hidden
        If listLocked.Contains(e.ColumnIndex) Then
            e.Cancel = True
            e.NewWidth = 0
        End If

    End Sub
End Class


Dave

Don't forget rate messages!
Find Me On: Web|Facebook|Twitter|LinkedIn
Waving? dave.m.auld[at]googlewave.com

GeneralRe: ListView: How to link columnheader into subitem Pin
jtpaa3-Feb-10 2:54
jtpaa3-Feb-10 2:54 
GeneralRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 3:00
professionalDaveAuld3-Feb-10 3:00 
GeneralRe: ListView: How to link columnheader into subitem Pin
JR2124-Feb-10 1:00
JR2124-Feb-10 1:00 
QuestionVB SendKeys -Done- Pin
εїзεїзεїз2-Feb-10 23:18
εїзεїзεїз2-Feb-10 23:18 
AnswerRe: VB SendKeys Pin
DaveAuld3-Feb-10 0:35
professionalDaveAuld3-Feb-10 0:35 
GeneralRe: VB SendKeys Pin
εїзεїзεїз3-Feb-10 1:07
εїзεїзεїз3-Feb-10 1:07 
GeneralRe: VB SendKeys Pin
DaveAuld3-Feb-10 1:23
professionalDaveAuld3-Feb-10 1:23 
AnswerRe: VB SendKeys Pin
Luc Pattyn3-Feb-10 1:57
sitebuilderLuc Pattyn3-Feb-10 1:57 
AnswerRe: VB SendKeys Pin
Anubhava Dimri3-Feb-10 18:31
Anubhava Dimri3-Feb-10 18:31 
QuestionWindows 7 registry error Pin
Gagan.202-Feb-10 22:16
Gagan.202-Feb-10 22:16 
AnswerRe: Windows 7 registry error Pin
Dave Kreskowiak3-Feb-10 2:06
mveDave Kreskowiak3-Feb-10 2:06 
QuestionAutomation error - issue with word Pin
Bad Programmer2-Feb-10 10:12
Bad Programmer2-Feb-10 10:12 
AnswerRe: Automation error - issue with word Pin
David Mujica2-Feb-10 10:22
David Mujica2-Feb-10 10:22 
AnswerRe: Automation error - issue with word Pin
Dave Kreskowiak2-Feb-10 10:54
mveDave Kreskowiak2-Feb-10 10:54 
AnswerRe: Automation error - issue with word Pin
koolprasad20033-Feb-10 18:18
professionalkoolprasad20033-Feb-10 18:18 
GeneralBluetooth Programming... Pin
Jamal Abdul Nasir2-Feb-10 7:42
Jamal Abdul Nasir2-Feb-10 7:42 
GeneralRe: Bluetooth Programming... Pin
Richard MacCutchan2-Feb-10 8:42
mveRichard MacCutchan2-Feb-10 8:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.