Click here to Skip to main content
15,893,487 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB Photo Screensaver Pin
Eddy Vluggen29-Dec-13 17:15
professionalEddy Vluggen29-Dec-13 17:15 
GeneralRe: VB Photo Screensaver Pin
Nate Schoonover31-Dec-13 9:00
Nate Schoonover31-Dec-13 9:00 
GeneralRe: VB Photo Screensaver Pin
Eddy Vluggen2-Jan-14 9:18
professionalEddy Vluggen2-Jan-14 9:18 
GeneralRe: VB Photo Screensaver Pin
Nate Schoonover2-Jan-14 11:37
Nate Schoonover2-Jan-14 11:37 
GeneralRe: VB Photo Screensaver Pin
Eddy Vluggen4-Jan-14 3:41
professionalEddy Vluggen4-Jan-14 3:41 
GeneralRe: VB Photo Screensaver Pin
Nate Schoonover4-Jan-14 18:17
Nate Schoonover4-Jan-14 18:17 
GeneralRe: VB Photo Screensaver Pin
Eddy Vluggen5-Jan-14 1:25
professionalEddy Vluggen5-Jan-14 1:25 
QuestionDataGridView populates only first row Pin
Sonhospa27-Dec-13 9:16
Sonhospa27-Dec-13 9:16 
Hi,

I hope you all had a merry Christmas and nice holidays with your beloved ones! Rose | [Rose]

I try to retrieve data from text files and show them in a Datagrieview control. Each of the files is represented in an instance of "SoundConfigFile", which are collected in a generic List(of SoundConfigFile). The problem is: Only one row (containing the data collected from the first file) shows up in the Datagridview!?!

In the forms constructor, I set
VB
dgvList.AutoGenerateColumns = True
dgvList.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnValidation
. The longer task of extracting the required data from files is handled in a separate thread:
VB
Private Sub ThreadFunction()

    Try
        SoundConfigFiles = New List(Of SoundConfigFile)
        Dim dirs As String() = Directory.GetFiles(My.Settings.FSACDir, "sound.cfg", SearchOption.AllDirectories)
        Dim max As Integer = dirs.Count()
        Dim done As Integer = 0
        Dim percent As Integer = 0
        Dim msg As String = String.Empty

        For Each configfile As String In dirs
            SoundConfigFiles.Add(New SoundConfigFile(Me, configfile))
            done += 1
            percent = CInt(done / max * 100)
            msg = String.Format("{0} finished ({1}%)", configfile, percent)
            'update the UI thread
            UpdateForm(configfile, percent, msg)
        Next
    Catch ex As Exception
    End Try
End Sub 'ThreadFunction
The UI thread is then updated in
VB
Public Sub UpdateForm(ByVal myItem As String, ByVal percent As Integer, ByVal msg As String)

    If Me.InvokeRequired Then
        Dim d As UpdateDelegate = AddressOf UpdateForm
        Me.Invoke(d, {myItem, percent, msg})
    Else
        Me.dgvList.DataSource = SoundConfigFiles
        Me.dgvList.Refresh()
        Me.ProgressBar1.Value = percent
        Me.myLabel.Text = msg
        Me.lblFinalMessage.Text = String.Format("{0} instances still open.", _
                                       SoundConfigFile.instances)

    End If
End Sub
I tried to find relevant information for hours now, but I can't get it to work. Does anyone of you have a good advice or can tell me what I'm doing wrong here? Confused | :confused:

Thank you,
Mick
AnswerRe: DataGridView populates only first row Pin
Eddy Vluggen29-Dec-13 2:51
professionalEddy Vluggen29-Dec-13 2:51 
AnswerRe: DataGridView populates only first row Pin
Sonhospa29-Dec-13 7:08
Sonhospa29-Dec-13 7:08 
GeneralRe: DataGridView populates only first row Pin
Eddy Vluggen29-Dec-13 17:12
professionalEddy Vluggen29-Dec-13 17:12 
QuestionLINQ Pin
tsunamigang23-Dec-13 18:04
tsunamigang23-Dec-13 18:04 
AnswerRe: LINQ Pin
thatraja23-Dec-13 20:09
professionalthatraja23-Dec-13 20:09 
GeneralRe: LINQ Pin
tsunamigang23-Dec-13 22:08
tsunamigang23-Dec-13 22:08 
QuestionProgressbar value not accurate? Pin
Sonhospa21-Dec-13 0:50
Sonhospa21-Dec-13 0:50 
AnswerRe: Progressbar value not accurate? Pin
Dave Kreskowiak21-Dec-13 4:50
mveDave Kreskowiak21-Dec-13 4:50 
NewsRe: Progressbar value not accurate? Pin
Sonhospa21-Dec-13 9:04
Sonhospa21-Dec-13 9:04 
GeneralRe: Progressbar value not accurate? Pin
Dave Kreskowiak21-Dec-13 11:34
mveDave Kreskowiak21-Dec-13 11:34 
QuestionVerification Failure (DigitalPersona 4000B) Pin
Member 1048039921-Dec-13 0:35
Member 1048039921-Dec-13 0:35 
AnswerRe: Verification Failure (DigitalPersona 4000B) Pin
Dave Kreskowiak21-Dec-13 4:46
mveDave Kreskowiak21-Dec-13 4:46 
QuestionException Pin
tsunamigang19-Dec-13 20:10
tsunamigang19-Dec-13 20:10 
AnswerRe: Exception Pin
Richard MacCutchan19-Dec-13 21:57
mveRichard MacCutchan19-Dec-13 21:57 
QuestionAnyone else with VB 2010 forms suddenly slow? Pin
BradITM19-Dec-13 11:43
BradITM19-Dec-13 11:43 
AnswerRe: Anyone else with VB 2010 forms suddenly slow? Pin
Dave Kreskowiak19-Dec-13 12:46
mveDave Kreskowiak19-Dec-13 12:46 
AnswerRe: Anyone else with VB 2010 forms suddenly slow? Pin
Simon_Whale20-Dec-13 5:05
Simon_Whale20-Dec-13 5:05 

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.