Bindingsource problem

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
 
L

Lloyd Sheen

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
 
F

friend

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
 
C

Cor Ligthert[MVP]

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
 

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

Top