473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ArgumentException and ArgumentOutOfRangeException

hello everybody,

<first of all i am sorry if i have already submitted similar thread, because i wasnt sure whether this thread has been submitted since i was redirected to the login page>

i am working on a project on .net CF using VB. in my project, i have a datagrid which is bind it to a datasource as below (in form activated):

ds = Globall.ReadXML.ReadStudentXML <-- reading from a class
With DataGrid1
.DataSource = ds.Tables("student")
.DataBindings.Clear()
.DataBindings().Add("Text", .DataSource, "StudID")

then in my mouseUp event, where i click on a row header in the datagrid, i would want to filter the row according to the primary key and display only the row's information to some label controls. i did a filter and some data binding to label as below :

With DataGrid1

If .HitTest(e.X, e.Y).Type = HitTestType.RowHeader Then

ds.Tables("student").DefaultView.RowFilter = "StudID= ' " &DataGrid1.Text & "' " <--- this is the primary key that i bind to the datagrid earlier i (i am not sure whether this is correct)

lblID.DataBindings.Add("Text",ds.Tables("student") , "StudID")
lblName.DataBindings.Add("Text",ds.Tables("student "), "StudName")
lblClass.DataBindings.Add("Text",ds.Tables("studen t"), "Class")

End If
End With


This code works fine for the the few rows of the datagrid. But when i select the 5th row of the datagrid, it throws the exception "ArgumentException"

I am confused as to what happened. i tried several other ways, such as putting the lbl.databindings in the form activated, but it returned the ArgumentOutOfRange Exception.

i suspect the problem came from this line :

ds.Tables("student").DefaultView.RowFilter = "StudID= ' " &DataGrid1.Text & "' "

but i dont know how to fix it nor i see anything wrong with it.. Please help to give advise.. i've been working on this for two days, and yet i dont know what is wrong with it.

fyi : what i want to do is just access the value on the datagrid, instead of the value in the underlying datasource object and display it on the label control.

Hope someone could help.. Thanks in advance

regards,
Zoe
Mar 12 '07 #1
2 1578
vijaydiwakar
579 512MB
hello everybody,

<first of all i am sorry if i have already submitted similar thread, because i wasnt sure whether this thread has been submitted since i was redirected to the login page>

i am working on a project on .net CF using VB. in my project, i have a datagrid which is bind it to a datasource as below (in form activated):

ds = Globall.ReadXML.ReadStudentXML <-- reading from a class
With DataGrid1
.DataSource = ds.Tables("student")
.DataBindings.Clear()
.DataBindings().Add("Text", .DataSource, "StudID")

then in my mouseUp event, where i click on a row header in the datagrid, i would want to filter the row according to the primary key and display only the row's information to some label controls. i did a filter and some data binding to label as below :

With DataGrid1

If .HitTest(e.X, e.Y).Type = HitTestType.RowHeader Then

ds.Tables("student").DefaultView.RowFilter = "StudID= ' " &DataGrid1.Text & "' " <--- this is the primary key that i bind to the datagrid earlier i (i am not sure whether this is correct)

lblID.DataBindings.Add("Text",ds.Tables("student") , "StudID")
lblName.DataBindings.Add("Text",ds.Tables("student "), "StudName")
lblClass.DataBindings.Add("Text",ds.Tables("studen t"), "Class")

End If
End With


This code works fine for the the few rows of the datagrid. But when i select the 5th row of the datagrid, it throws the exception "ArgumentException"

I am confused as to what happened. i tried several other ways, such as putting the lbl.databindings in the form activated, but it returned the ArgumentOutOfRange Exception.

i suspect the problem came from this line :

ds.Tables("student").DefaultView.RowFilter = "StudID= ' " &DataGrid1.Text & "' "

but i dont know how to fix it nor i see anything wrong with it.. Please help to give advise.. i've been working on this for two days, and yet i dont know what is wrong with it.

fyi : what i want to do is just access the value on the datagrid, instead of the value in the underlying datasource object and display it on the label control.

Hope someone could help.. Thanks in advance

regards,
Zoe
what's d value in 5th row for stuidid?
what's the type of studid in db?
explain with some techinical details
Mar 12 '07 #2
what's d value in 5th row for stuidid?
what's the type of studid in db?
explain with some techinical details

the studID is of type varchar. In fact, not only the 5th row, all the rows after that cannot be retrieved. The studID for the rows are as below :

1st : CB001
2nd: CB002
3rd: CB003
4th: CB004
5th: CB005
6th: CB006 and
7th: CB007

i am using sqlserver 2000 and i pull all the data into dataset, write to xml and read from the xml file into dataset for further manipulation.

thank you
Mar 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brian | last post by:
I'm having intermittent trouble with a call to the Read method of the HttpWebResponse object. I get an ArumentOutOfRangeException claiming that deep down inside of the Read method, the count...
7
by: Dustin B | last post by:
Since this issue encompasses so many things - I have to generally post it I guess. I'm building an application for a Wireless PDA - when it is connected to the Network I tested a TCPListener &...
3
by: marcstober | last post by:
Hello, I have some code like: public int MyProperty { set { if (value < 0) { throw new ArgumentOutOfRangeException("??paramName??", "Value must be positive.") } _myProperty = value; }
1
by: Hozi | last post by:
I am getting the below error when asp.net tries to parse the .aspx file. The funny part is that the error only seems to be happening when viewing the page throuh IE 6 and not Netscape browsers. I...
18
by: Atara | last post by:
In my apllication I use the following code: '-- My Code: Public Shared Function strDate2Date(ByVal strDate As String) As System.DateTime Dim isOk As Boolean = False If (strDate Is Nothing)...
1
by: ÀÏÆÅ»³ÔÐ6¸öÔ | last post by:
how can i override the "ArgumentOutOfRangeException" or catch it in my dorpdownlist?
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
1
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
1
by: =?Utf-8?B?V2VzdGU=?= | last post by:
I am throwing the ArgumentOutOfRangeException in my code as shown below throw new ArgumentOutOfRangeException("value", "Value must be 0"); my catch block is below ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.