I have this code to read a text file (.txt) and fill a dataset and then
filter, using DataView, by user. The final result I want to put into a
datagrig, but this last part is not happen and I don't know why.


the code is below

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

LerLinha = New StreamReader(LerPath)

dsMrc = New DataSet
dtMrc = New DataTable("Mrc")
dcMrc = New DataColumn("Cod",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Data",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Hora",
System.Type.GetType("System.String"))

dtMrc.Columns.Add("Cod")
dtMrc.Columns.Add("Data")
dtMrc.Columns.Add("Hora")

Do
txtLine = LerLinha.ReadLine()

If Not txtLine Is Nothing Then
Cd = ProcessCod(txtLine)
dtData = ProcessData(txtLine)
dtHora = ProcessHora(txtLine)

drMrc = dtMrc.NewRow()
drMrc("Cod") = Cd
drMrc("Data") = dtData
drMrc("Hora") = dtHora

dtMrc.Rows.Add(drMrc)
End If

'dsMrc.Tables("Mrc").Rows.Add(drMrc)
Loop Until txtLine Is Nothing

dsMrc.Tables.Add(dtMrc)
'dsMrc.Tables("Mrc").Select("Cod='" & FindUser & "'")

Dim strFilter As String
Dim findRows() As DataRow
Dim dtAux As DataTable

Dim v As New DataView
v.Table = dtMrc
v.RowFilter = "Cod=" & FindUser
v.Sort = "Data ASC"
//this is my datagrid
dgMarcacoes.DataSource = v

LerLinha.Close()
LerLinha = Nothing
------------------------------------------------------------------------


Could you help me????


--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Re: View data in DataGrid by Selen

Selen
Thu Mar 04 04:30:53 CST 2004

You must use dgMarcacoes.DataBind() after dgMarcacoes.DataSource = v


"ruca" <ruuca@iol.pt>, iletide þunu yazdý
news:eMzZMDdAEHA.3804@TK2MSFTNGP09.phx.gbl...
>
>
> I have this code to read a text file (.txt) and fill a dataset and then
> filter, using DataView, by user. The final result I want to put into a
> datagrig, but this last part is not happen and I don't know why.
>
>
> the code is below
>
> ------------------------------------------------------------------------
>
> LerLinha = New StreamReader(LerPath)
>
> dsMrc = New DataSet
> dtMrc = New DataTable("Mrc")
> dcMrc = New DataColumn("Cod",
> System.Type.GetType("System.String"))
> dcMrc = New DataColumn("Data",
> System.Type.GetType("System.String"))
> dcMrc = New DataColumn("Hora",
> System.Type.GetType("System.String"))
>
> dtMrc.Columns.Add("Cod")
> dtMrc.Columns.Add("Data")
> dtMrc.Columns.Add("Hora")
>
> Do
> txtLine = LerLinha.ReadLine()
>
> If Not txtLine Is Nothing Then
> Cd = ProcessCod(txtLine)
> dtData = ProcessData(txtLine)
> dtHora = ProcessHora(txtLine)
>
> drMrc = dtMrc.NewRow()
> drMrc("Cod") = Cd
> drMrc("Data") = dtData
> drMrc("Hora") = dtHora
>
> dtMrc.Rows.Add(drMrc)
> End If
>
> 'dsMrc.Tables("Mrc").Rows.Add(drMrc)
> Loop Until txtLine Is Nothing
>
> dsMrc.Tables.Add(dtMrc)
> 'dsMrc.Tables("Mrc").Select("Cod='" & FindUser & "'")
>
> Dim strFilter As String
> Dim findRows() As DataRow
> Dim dtAux As DataTable
>
> Dim v As New DataView
> v.Table = dtMrc
> v.RowFilter = "Cod=" & FindUser
> v.Sort = "Data ASC"
> //this is my datagrid
> dgMarcacoes.DataSource = v
>
> LerLinha.Close()
> LerLinha = Nothing
> ------------------------------------------------------------------------
>
>
> Could you help me????
>
>
> --
>
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
>



Re: View data in DataGrid by ruca

ruca
Thu Mar 04 06:11:22 CST 2004

Ok. Thanks

After my post I find out that. :)
Thank you very much anyway for your help

Ruca

"Selen" <skiyanc@yahoo.com> escreveu na mensagem
news:ubm4HPdAEHA.1964@TK2MSFTNGP11.phx.gbl...
> You must use dgMarcacoes.DataBind() after dgMarcacoes.DataSource = v
>
>
> "ruca" <ruuca@iol.pt>, iletide þunu yazdý
> news:eMzZMDdAEHA.3804@TK2MSFTNGP09.phx.gbl...
> >
> >
> > I have this code to read a text file (.txt) and fill a dataset and then
> > filter, using DataView, by user. The final result I want to put into a
> > datagrig, but this last part is not happen and I don't know why.
> >
> >
> > the code is below
> >
> > ------------------------------------------------------------------------
> >
> > LerLinha = New StreamReader(LerPath)
> >
> > dsMrc = New DataSet
> > dtMrc = New DataTable("Mrc")
> > dcMrc = New DataColumn("Cod",
> > System.Type.GetType("System.String"))
> > dcMrc = New DataColumn("Data",
> > System.Type.GetType("System.String"))
> > dcMrc = New DataColumn("Hora",
> > System.Type.GetType("System.String"))
> >
> > dtMrc.Columns.Add("Cod")
> > dtMrc.Columns.Add("Data")
> > dtMrc.Columns.Add("Hora")
> >
> > Do
> > txtLine = LerLinha.ReadLine()
> >
> > If Not txtLine Is Nothing Then
> > Cd = ProcessCod(txtLine)
> > dtData = ProcessData(txtLine)
> > dtHora = ProcessHora(txtLine)
> >
> > drMrc = dtMrc.NewRow()
> > drMrc("Cod") = Cd
> > drMrc("Data") = dtData
> > drMrc("Hora") = dtHora
> >
> > dtMrc.Rows.Add(drMrc)
> > End If
> >
> > 'dsMrc.Tables("Mrc").Rows.Add(drMrc)
> > Loop Until txtLine Is Nothing
> >
> > dsMrc.Tables.Add(dtMrc)
> > 'dsMrc.Tables("Mrc").Select("Cod='" & FindUser & "'")
> >
> > Dim strFilter As String
> > Dim findRows() As DataRow
> > Dim dtAux As DataTable
> >
> > Dim v As New DataView
> > v.Table = dtMrc
> > v.RowFilter = "Cod=" & FindUser
> > v.Sort = "Data ASC"
> > //this is my datagrid
> > dgMarcacoes.DataSource = v
> >
> > LerLinha.Close()
> > LerLinha = Nothing
> > ------------------------------------------------------------------------
> >
> >
> > Could you help me????
> >
> >
> > --
> >
> > Thank's (if you try to help me)
> > Hope this help you (if I try to help you)
> > ruca
> >
> >
>
>