Home All Groups Group Topic Archive Search About

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

Author
29 May 2010 6:10 PM
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 :)

Author
29 May 2010 6:51 PM
Armin Zingler
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.


--
Armin
Author
29 May 2010 9:18 PM
Mr. X.
O.K.
My mistake.
I didn't free an object that is connected to binding-source.
By doing that, some strange things happen.

Thanks :)

Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:ODwHDA2$KHA.5848@TK2MSFTNGP06.phx.gbl...
> 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.
>
>
> --
> Armin