Home All Groups Group Topic Archive Search About

Bindingsource problem

Author
15 Jun 2009 12:29 PM
fren4uu@googlemail.com
Hello all,

Please help in finding out the solution..
I have problem in saving the data through my.settings in datagridview
Here is my code : my.settings.test is of type bindingsource
Thank you for any help...

Public Class import
        Private mName As String
        Private mName1 As String
        '#Region "Properties"
        Public Property Name() As String
            Get
                Return mName
            End Get
            Set(ByVal value As String)
                mName = value
            End Set
        End Property
End Class

Public temp1 As New List(Of import)
Public bs as new bindingsource

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

        For i As Integer = 1 To 10
            Dim temp As New import
            temp.Name = "xxx"
            temp1.Add(temp)
        Next

        bs.DataSource = temp1

        My.Settings.test = bs
        My.Settings.Save()


        ' Attach the BindingSource to the DataGridView.
        Me.DataGridView1.DataSource = bs
End sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

    Me.DataGridView1.DataSource = My.Settings.test

End sub

Author
15 Jun 2009 2:33 PM
Lloyd Sheen
<fren***@googlemail.com> wrote in message
Show quoteHide quote
news:6a3a95d8-1588-43aa-a96b-b3efd12dcabc@x3g2000yqa.googlegroups.com...
> Hello all,
>
> Please help in finding out the solution..
> I have problem in saving the data through my.settings in datagridview
> Here is my code : my.settings.test is of type bindingsource
> Thank you for any help...
>
> Public Class import
>        Private mName As String
>        Private mName1 As String
>        '#Region "Properties"
>        Public Property Name() As String
>            Get
>                Return mName
>            End Get
>            Set(ByVal value As String)
>                mName = value
>            End Set
>        End Property
> End Class
>
> Public temp1 As New List(Of import)
> Public bs as new bindingsource
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>
>        For i As Integer = 1 To 10
>            Dim temp As New import
>            temp.Name = "xxx"
>            temp1.Add(temp)
>        Next
>
>        bs.DataSource = temp1
>
>        My.Settings.test = bs
>        My.Settings.Save()
>
>
>        ' Attach the BindingSource to the DataGridView.
>        Me.DataGridView1.DataSource = bs
> End sub
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Me.DataGridView1.DataSource = My.Settings.test
>
> End sub

What is the error you recieve?

LS
Author
15 Jun 2009 2:59 PM
friend
Show quote Hide quote
On Jun 15, 4:33 pm, "Lloyd Sheen" <a...@b.c> wrote:
> <fren***@googlemail.com> wrote in message
>
> news:6a3a95d8-1588-43aa-a96b-b3efd12dcabc@x3g2000yqa.googlegroups.com...
>
>
>
> > Hello all,
>
> > Please help in finding out the solution..
> > I have problem in saving the data through my.settings in datagridview
> > Here is my code : my.settings.test is of type bindingsource
> > Thank you for any help...
>
> > Public Class import
> >        Private mName As String
> >        Private mName1 As String
> >        '#Region "Properties"
> >        Public Property Name() As String
> >            Get
> >                Return mName
> >            End Get
> >            Set(ByVal value As String)
> >                mName = value
> >            End Set
> >        End Property
> > End Class
>
> > Public temp1 As New List(Of import)
> > Public bs as new bindingsource
>
> > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
>
> >        For i As Integer = 1 To 10
> >            Dim temp As New import
> >            temp.Name = "xxx"
> >            temp1.Add(temp)
> >        Next
>
> >        bs.DataSource = temp1
>
> >        My.Settings.test = bs
> >        My.Settings.Save()
>
> >        ' Attach the BindingSource to the DataGridView.
> >        Me.DataGridView1.DataSource = bs
> > End sub
>
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
>
> > Me.DataGridView1.DataSource = My.Settings.test
>
> > End sub
>
> What is the error you recieve?
>
> LS

I didnt get any error but when the form is loaded the datagridview
appear to be empty
Instead I need to have the values when the form is loaded
Author
15 Jun 2009 3:27 PM
Cor Ligthert[MVP]
Hi,

The code you shows should in my idea present an empty datagridview

Cor

Show quoteHide quote
"friend" <lavanyaredd***@gmail.com> wrote in message
news:9e2e22d6-9d3f-471c-817d-bfc7590ce06d@c36g2000yqn.googlegroups.com...
On Jun 15, 4:33 pm, "Lloyd Sheen" <a...@b.c> wrote:
> <fren***@googlemail.com> wrote in message
>
> news:6a3a95d8-1588-43aa-a96b-b3efd12dcabc@x3g2000yqa.googlegroups.com...
>
>
>
> > Hello all,
>
> > Please help in finding out the solution..
> > I have problem in saving the data through my.settings in datagridview
> > Here is my code : my.settings.test is of type bindingsource
> > Thank you for any help...
>
> > Public Class import
> > Private mName As String
> > Private mName1 As String
> > '#Region "Properties"
> > Public Property Name() As String
> > Get
> > Return mName
> > End Get
> > Set(ByVal value As String)
> > mName = value
> > End Set
> > End Property
> > End Class
>
> > Public temp1 As New List(Of import)
> > Public bs as new bindingsource
>
> > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
>
> > For i As Integer = 1 To 10
> > Dim temp As New import
> > temp.Name = "xxx"
> > temp1.Add(temp)
> > Next
>
> > bs.DataSource = temp1
>
> > My.Settings.test = bs
> > My.Settings.Save()
>
> > ' Attach the BindingSource to the DataGridView.
> > Me.DataGridView1.DataSource = bs
> > End sub
>
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
>
> > Me.DataGridView1.DataSource = My.Settings.test
>
> > End sub
>
> What is the error you recieve?
>
> LS

I didnt get any error but when the form is loaded the datagridview
appear to be empty
Instead I need to have the values when the form is loaded