Programming iPAQ

  • Thread starter Thread starter David Fúnez
  • Start date Start date
D

David Fúnez

I have a little APP for an iPAQ that runs Ok but it does not show any
record, the problem is with the grid as shown, it has not a DATAMEMBER
Property to show the records.

So, any help will be wellcome.

**** The Code *****
Dim dsLibros As DataSet
Dim dtPrestados As DataTable
Dim xmlFile As String = "Libros.xml"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dtPrestados = New DataTable("prestados")
dtPrestados.Columns.Add("Id", GetType(Integer))
dtPrestados.Columns.Add("Titulo", GetType(String))
dtPrestados.Columns.Add("prestadosA", GetType(String))
dtPrestados.Columns.Add("Fecha", GetType(Date))
dtPrestados.Columns.Add("Devuelto", GetType(Boolean))

With dtPrestados.Columns("id")
.AutoIncrement = True
.AutoIncrementSeed = 1
End With

dsLibros = New DataSet("Libros")
dsLibros.Tables.Add(dtPrestados)

dgLibros.DataSource = dsLibros
'dgLibros.DataMember = "Prestados" ====> The problem

If File.Exists(xmlFile) Then
dsLibros.ReadXml(xmlFile)
End If
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSalir.Click
Me.Close()
End Sub

Private Sub btnSalvar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSalvar.Click
dsLibros.WriteXml(xmlFile)
End Sub
 
Hi,

You have to specify the path for file.exists to work. Try something
like this.

Dim strPath As String

strPath = System.IO.Path.GetDirectoryName( _

System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)

Dim fXml As New FileInfo(strPath & "\config.xml")

Dim bXml As Boolean = fXml.Exists

If bXml Then

ds = New DataSet

ds.ReadXml(strPath & "\config.xml")

End If



Ken

--------------------

I have a little APP for an iPAQ that runs Ok but it does not show any
record, the problem is with the grid as shown, it has not a DATAMEMBER
Property to show the records.

So, any help will be wellcome.

**** The Code *****
Dim dsLibros As DataSet
Dim dtPrestados As DataTable
Dim xmlFile As String = "Libros.xml"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dtPrestados = New DataTable("prestados")
dtPrestados.Columns.Add("Id", GetType(Integer))
dtPrestados.Columns.Add("Titulo", GetType(String))
dtPrestados.Columns.Add("prestadosA", GetType(String))
dtPrestados.Columns.Add("Fecha", GetType(Date))
dtPrestados.Columns.Add("Devuelto", GetType(Boolean))

With dtPrestados.Columns("id")
.AutoIncrement = True
.AutoIncrementSeed = 1
End With

dsLibros = New DataSet("Libros")
dsLibros.Tables.Add(dtPrestados)

dgLibros.DataSource = dsLibros
'dgLibros.DataMember = "Prestados" ====> The problem

If File.Exists(xmlFile) Then
dsLibros.ReadXml(xmlFile)
End If
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSalir.Click
Me.Close()
End Sub

Private Sub btnSalvar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSalvar.Click
dsLibros.WriteXml(xmlFile)
End Sub
 
I am coming to your query a bit late, but from what I can see quoted below,
your problem may be the understanding of the Pocket PC file Structure.

\ indicates the root folder for the Pocket PC. So if you have your xml data
file in your program's folder, which in turn is in the Program Files folder,
you would read it as follows:

ds.ReadXml("\Program Files\MyProgram\MyData.xml")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top