Bindingsource problem

  • Thread starter Thread starter fren4uu
  • Start date Start date
F

fren4uu

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
 
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
 
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
 
Hi,

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

Cor

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
 
Back
Top