![]() Jun 25, 2018 Review the XML file's code. While the XML file's actual formatting (if present) won't display due to being opened in a text editor, you will be able to see the code that was used to create the XML file. If you want to see the XML file's formatting, try using a browser or using an XML viewer. 'The open XML file.docx cannot be opened because there are problems with the contents or the file name might contain invalid characters (for example, /)' I have tried looking online for a solution to the problem but none have worked. I have 800 xml files and I want to edit the contents of these files. For example change the value 'LEFT' to 'RIGHT'. But it is very difficult to change so may files manually. Can anyone suggest a. The feedback you provide will help us show you more relevant content in the future. More specifically, I have an application that allows a user to choose different xml files from a drop-down list. The first xml file that is selected displays its contents fine in the DataGridView. Now, let's say I want to look at another xml file in the drop-down list and have it's contents show in the DataGridView. I select another xml file BUT the DataGridView appears empty when I click on a button with a click event that is to display the contents of the xml file. Thanks Riquel and thanks especially to Dig-Boy for all the assistance. I hope I didn't cause to many 'rollings of the eyes' with some of my responses.:) I fixed my problem using the following code. It was as easy a solution as I had originally suspected. Private Sub btnRead_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click Dim dsServers As New DataSet( 'server' ) ' display contents of XML file Dim filePath As String filePath = 'C: Documents and Settings firtsname.lastname My Documents Visual Studio 2008 Projects XMLSaveAndRetrieve XMLSaveAndRetrieve bin Debug ' + lstXMLFile.Text dsServers.ReadXml(filePath) With DataGridView1.DataSource = Nothing.AutoGenerateColumns = True.DataSource = dsServers.DataMember = txtParentNode.Text End With. I should have been more explicit. When setting it to the table in a dataset you do not need to set the data member. In essence, the way you originally have it written by setting both properties is the same thing as setting it only once as I have it with the specific table. So you really shoudl do one or the other approach -- either (pseudo code) DataSource = Dataset.Tables(0) or DataSource = Dataset; DataMember = 'TableName'. Max msp 5 1 keygen for mac. ![]() Also, I put the zero index for the Tables property but this may not be a logical choice for you. That's where you should be indicating a specific table. If you know the name of the table then you can use that as an argument (it can be either an integer or a string)..DataSource = dsServers.Tables( txtParentNode.Text) if this is still not working then you shoudl iterate through the tables collection to see what you really have and that it matches the parent node (and that the parent node actually is what you think it is). For Each t As DataTable In dsServers.Tables Debug.WriteLine(t.TableName) Next. That just about does the trick. As you were saying it is more or less a different way to do what using both the.Datasource and.Datamember properties do when used together. What is happening now is the rows from the 2nd xml file I am selecting are being appended to the rows from the 1st xml file. I attempted to use a conditional to remove the rows from the 1st xml file prior to populating the DGV with just the rows from the 2nd xml file by using the following: If DataGridView1.DisplayedRowCount(includePartialRow) > 0 Then DataGridView1.Columns.Clear() End If With DataGridView1.AutoGenerateColumns = True.DataSource = dsServers.Tables(txtParentNode.Text) End With This did not work as I had hoped. I was attempting to determine if there already are rows populated to have them removed THEN populate the DGV with just the rows from the new xml file being selected. With DataGridView1.DataSource = Nothing.AutoGenerateColumns = True.DataSource = dsServers.Tables(txtParentNode.Text) End With I'm not sure why you are testing the Displayed rows or even why you care what the previous XML table has -- and this may be the reason this discussion has kept going on, maybe there is something fundamental to your design requirements that I do not understand.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |