Timer control error

G

Guest

Hi..
My problem is..
I am loading a datagrid by a dataset.My dataset changes lot of times in a day.And i want to display all those chages on my datagrid,the moment the change occurs.
What I am doing is this....
I have added a timer to my form,and the interval of the timer is 10 sec.So after every 10 seconds,the datagrid refreshes.

But I also get the following error:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: '0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'.
at System.Windows.Forms.ScrollBar.set_Value(Int32 value)
at System.Windows.Forms.DataGrid.SetDataGridTable(DataGridTableStyle newTable, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.Set_ListManager(Object newDataSource, String newDataMember, Boolean force, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.Set_ListManager(Object newDataSource, String newDataMember, Boolean force)
at System.Windows.Forms.DataGrid.SetDataBinding(Object dataSource, String dataMember)
at TestTree.JobActivity.loadDataGrid() in c:\idealstorbackup\jobactivity.cs:line 172
at TestTree.JobActivity.timer1_Tick(Object sender, EventArgs e) in c:\idealstorbackup\jobactivity.cs:line 181
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
TestTree
Assembly Version: 1.0.1643.27366
Win32 Version: 1.0.1643.27366
CodeBase: file:///C:/IdealStorBackup/bin/Debug/TestTree.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
Raccoom.TreeViewFolderBrowser
Assembly Version: 2.1.0.0
Win32 Version: 2.1.0.0
CodeBase: file:///C:/IdealStorBackup/bin/Debug/Raccoom.TreeViewFolderBrowser.DLL
----------------------------------------
Raccoom.TreeViewFolderBrowser.DataProviders
Assembly Version: 2.1.0.0
Win32 Version: 2.1.0.0
CodeBase: file:///C:/IdealStorBackup/bin/Debug/Raccoom.TreeViewFolderBrowser.DataProviders.DLL
----------------------------------------
Interop.Shell32
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/IdealStorBackup/bin/Debug/Interop.Shell32.DLL
----------------------------------------
CustomMarshalers
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/custommarshalers/1.0.5000.0__b03f5f7f11d50a3a/custommarshalers.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

Can anyone tell me why this error occurs?and what is the solution?

Thanks
MVB
 
G

Guest

It looks like (from the exception) that your are attempting to reset the scrollbar to the top of the screen when you refresh the datagrid. When you do this it appears that you are settting the value of the scrollbar to 0 - which is below the minimum value of the scrollbar. I would suggest that you do something like:

MyForm.Scrollbar.value = MyForm.Scrollbar.Minimum

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top