bindingSource.Position = ... doesn't change the current property.

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

Hello.
I have
bs as BindingSource

When I do :
bs.Position = 3.

Current isn't changed to the position I gave.

What should I do instead ?

Thanks :)
 
Am 29.05.2010 20:10, schrieb Mr. X.:
Hello.
I have
bs as BindingSource

When I do :
bs.Position = 3.

Current isn't changed to the position I gave.

What should I do instead ?

How do you see that it doesn't change? I've tried it based on the example here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.current(VS.90).aspx

If you add

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)

PopulateBindingSourceWithFonts()
Debug.WriteLine(bindingSource1.Current.ToString)
bindingSource1.Position = 1
Debug.WriteLine(bindingSource1.Current.ToString)

End Sub

the output is:

[Font: Name=Arial Black, Size=8, Units=3, GdiCharSet=1, GdiVerticalFont=False]
[Font: Name=Bart, Size=9, Units=3, GdiCharSet=1, GdiVerticalFont=False]

So, Current does change in this case.
 
O.K.
My mistake.
I didn't free an object that is connected to binding-source.
By doing that, some strange things happen.

Thanks :)

Armin Zingler said:
Am 29.05.2010 20:10, schrieb Mr. X.:
Hello.
I have
bs as BindingSource

When I do :
bs.Position = 3.

Current isn't changed to the position I gave.

What should I do instead ?

How do you see that it doesn't change? I've tried it based on the example
here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.current(VS.90).aspx

If you add

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)

PopulateBindingSourceWithFonts()
Debug.WriteLine(bindingSource1.Current.ToString)
bindingSource1.Position = 1
Debug.WriteLine(bindingSource1.Current.ToString)

End Sub

the output is:

[Font: Name=Arial Black, Size=8, Units=3, GdiCharSet=1,
GdiVerticalFont=False]
[Font: Name=Bart, Size=9, Units=3, GdiCharSet=1, GdiVerticalFont=False]

So, Current does change in this case.
 
Back
Top