Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / December 2004

Tip: Looking for answers? Try searching our database.

Dataview in another assembly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kristian F. Thomsen - 22 Dec 2004 11:36 GMT
Hi all,

What is it about DataViews in another assembly ? Should it not be possible ?

I have a DataTable and a DataView in one assembly.
I have a Datagrid on a windowsform in my main application, and it's
DataSource is bound to the DataView in my assembly.
The DataTable in the assembly is updated every second, by a subroutine in
the assembly, and the subroutine is called from my main application.

My problem is that the application randomly crashes with an
NullReferenceException.... What could be wrong ?

Here is the stack trace

System.NullReferenceException: Object reference not set to an instance of an
object.
  at System.Data.DataView.GetRecord(Int32 recordIndex)
  at System.Data.DataView.IsOriginalVersion(Int32 index)
  at System.Data.DataRowView.GetColumnValue(DataColumn column)
  at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
  at
System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager
source, Int32 rowNum)
  at System.Windows.Forms.DataGridTextBoxColumn.Paint(Graphics g, Rectangle
bounds, CurrencyManager source, Int32 rowNum, Brush backBrush, Brush
foreBrush, Boolean alignToRight)
  at
System.Windows.Forms.DataGridRelationshipRow.PaintCellContents(Graphics g,
Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush
foreBrush, Boolean alignToRight)
  at System.Windows.Forms.DataGridRow.PaintData(Graphics g, Rectangle
bounds, Int32 firstVisibleColumn, Int32 columnCount, Boolean alignToRight)
  at System.Windows.Forms.DataGridRelationshipRow.Paint(Graphics g,
Rectangle bounds, Rectangle trueRowBounds, Int32 firstVisibleColumn, Int32
numVisibleColumns, Boolean alignToRight)
  at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle&
boundingRect)
  at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle
gridBounds)
  at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe)
  at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
  at System.Windows.Forms.Control.WmPaint(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Thanks in advance

Br

Kristian F. Thomsen
Manohar Kamath - 24 Dec 2004 17:57 GMT
Kristian,

Not sure if this will solve the problem -- but everytime your data changes,
set the DataSource of your grid to the view, and see if this makes any
difference.

Signature

Manohar Kamath
Editor, .netWire
www.dotnetwire.com

> Hi all,
>
[quoted text clipped - 18 lines]
>    at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
>    at

System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager
> source, Int32 rowNum)
>    at System.Windows.Forms.DataGridTextBoxColumn.Paint(Graphics g, Rectangle
[quoted text clipped - 28 lines]
>
> Kristian F. Thomsen
Kristian F. Thomsen - 24 Dec 2004 22:31 GMT
No, it does not help:-( Allready tried it.

> Kristian,
>
[quoted text clipped - 67 lines]
>>
>> Kristian F. Thomsen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.