E
Eric
Hi,
With the following code I show some information to the user:
Dim ofd As New OpenFileDialog
ofd.CheckFileExists = True
ofd.CheckPathExists = True
ofd.DefaultExt = "HCF"
ofd.Filter = "Claim form files (*.HCF)|*.hcf|All files (*.*)|*.*"
ofd.InitialDirectory = "c:\"
ofd.Multiselect = False
ofd.RestoreDirectory = True
ofd.ShowHelp = False
ofd.ShowReadOnly = False
ofd.SupportMultiDottedExtensions = True
ofd.Title = "Open data file"
dgr = ofd.ShowDialog
If dgr = Windows.Forms.DialogResult.Cancel Then Exit Sub
Try
dsData.Tables.Remove("overtime")
Catch ex As Exception
End Try
dsData.ReadXml(ofd.FileName)
Me.dgvData.DataSource = dsData
Me.dgvData.DataMember = "overtime"
Me.dgvData.ClearSelection()
Me.dgvData.Refresh()
The first time I click on the OPEN button, this goes fine, but any next time
it loads the data in the dataset, but nothing is shown in the DataGridView.
How is this possible, am I doing something wrong?
rg,
Eric
P.s. it's in VB2005.
With the following code I show some information to the user:
Dim ofd As New OpenFileDialog
ofd.CheckFileExists = True
ofd.CheckPathExists = True
ofd.DefaultExt = "HCF"
ofd.Filter = "Claim form files (*.HCF)|*.hcf|All files (*.*)|*.*"
ofd.InitialDirectory = "c:\"
ofd.Multiselect = False
ofd.RestoreDirectory = True
ofd.ShowHelp = False
ofd.ShowReadOnly = False
ofd.SupportMultiDottedExtensions = True
ofd.Title = "Open data file"
dgr = ofd.ShowDialog
If dgr = Windows.Forms.DialogResult.Cancel Then Exit Sub
Try
dsData.Tables.Remove("overtime")
Catch ex As Exception
End Try
dsData.ReadXml(ofd.FileName)
Me.dgvData.DataSource = dsData
Me.dgvData.DataMember = "overtime"
Me.dgvData.ClearSelection()
Me.dgvData.Refresh()
The first time I click on the OPEN button, this goes fine, but any next time
it loads the data in the dataset, but nothing is shown in the DataGridView.
How is this possible, am I doing something wrong?
rg,
Eric
P.s. it's in VB2005.