CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: VS 2012 - Getting help with making a label blink during listview load

  1. #1
    Join Date
    May 2019
    Location
    Michigan
    Posts
    25

    VS 2012 - Getting help with making a label blink during listview load

    I am using Visual Studio 2012 (yea, I know it's old) and I'm trying to make a label blink during the loading of some words into a listview. This is what I have tried so far:

    Code:
    	Private Sub OPENToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles OPENToolStripMenuItem1.Click	
    
    	Dim loadinglist As Boolean = True
    	Dim tmpInt1 As Integer = 0
    	Dim tmpInt2 As Integer = 0
    	Dim tmpString1 As String = Nothing
    	
    	' Step 1: Set up the OpenFileDialog box:
            OpenFileDialog1.AddExtension = True
            OpenFileDialog1.CheckFileExists = True
            OpenFileDialog1.CheckPathExists = True
            OpenFileDialog1.DefaultExt = ".dat"
            OpenFileDialog1.FileName = Nothing
            OpenFileDialog1.Filter = "Dictionary Files (*.dat)|*.dat"
            OpenFileDialog1.InitialDirectory = My.Settings.DictPath
            OpenFileDialog1.Multiselect = False
            OpenFileDialog1.Title = "Select the DICTIONARY file you wish to edit:"
    	
    	' Step 2: Get the DICTIONARY File name to open
            If OpenFileDialog1.ShowDialog = DialogResult.Cancel Then Exit Sub
    
            Timer1.Start()
    
            ' Step 3: Open the DICTIONARY file
            FileNum = FreeFile()
            FileOpen(FileNum, OpenFileDialog1.FileName, OpenMode.Random, OpenAccess.Read, OpenShare.LockRead)
            FileGet(FileNum, tmpInt2, 1) ' This is the number of words in the file
            FileGet(FileNum, tmpInt1, 2) ' This is the number of blocked words in the file
    
            ' Step 4: Loop to input all of the words & the wordblock indicators (checkboxes)
            For x As Integer = 3 To (tmpInt2 + 2)
                FileGet(FileNum, tmpString1, x)
                ListView1.Items.Add(Trim(Mid(tmpString1, 1, 15)))
                If Trim(Mid(tmpString1, 16, 1)) = "#" Then ListView1.Items.Item(x - 3).Checked = True
            Next
    
            ' Step 5: Close the file.
            FileClose(FileNum)
            Timer1.Stop()
            Label1.Hide()
    
    	End Sub
            
    
    	Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    
           	Label1.Visible = Not Label1.Visible
    
        	End Sub
    The Timer1_Tick event is never fired. Why? The interval is set to 1000 (blink once a second?)
    Can someone help me?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,360

    Re: VS 2012 - Getting help with making a label blink during listview load

    Try to get the timer working by clicking on the button. Do this by commenting out the file code. Get it working like this first. Then add the file code back in.

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,354

    Re: VS 2012 - Getting help with making a label blink during listview load

    How many words are you loading and how long is it taking.

    The code you have there looks like it will likely be pretty slow and could be a lot faster with a few tweaks.
    One thing to consider is to suspend the redrawing of the list while adding items to it. This often improves performance by leaps and bounds also do not use the old variant trim and mid functions.
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)