From: Mr. X. on 29 May 2010 14:10 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 :)
From: Armin Zingler on 29 May 2010 14:51 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
From: Mr. X. on 29 May 2010 17:18 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" <az.nospam(a)freenet.de> wrote in message news:ODwHDA2$KHA.5848(a)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
|
Pages: 1 Prev: need help looping through string of names Next: How to use Serial Port Component |