G
Guest
I have a datagrid derived class where i want to scroll the horizontal scroll
bar to the right. i tried the following code:
HScrollBar sb = (HScrollBar)base.GetType().GetField("m_sbHorz",
BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(this);
sb.Value=5;
but i received a NullReferenceException in System.Windows.Forms.DataGrid.Dll,
I tried the following code and the same exception happened
HScrollBar sb = (HScrollBar)base.GetType().GetField("m_sbHorz",
BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(this);
System.Reflection.PropertyInfo pi=sb.GetType().GetProperty
("Value",BindingFlags.Public | BindingFlags.Instance );
pi.SetValue (sb,90,null);
any suggestions??
bar to the right. i tried the following code:
HScrollBar sb = (HScrollBar)base.GetType().GetField("m_sbHorz",
BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(this);
sb.Value=5;
but i received a NullReferenceException in System.Windows.Forms.DataGrid.Dll,
I tried the following code and the same exception happened
HScrollBar sb = (HScrollBar)base.GetType().GetField("m_sbHorz",
BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(this);
System.Reflection.PropertyInfo pi=sb.GetType().GetProperty
("Value",BindingFlags.Public | BindingFlags.Instance );
pi.SetValue (sb,90,null);
any suggestions??