Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP PLEASE!!!!!!!!!!

Status
Not open for further replies.

Ahssan

Programmer
Nov 4, 2003
27
KW
Hi All

Im doing a small conversion in vb.net all i wanted to do is to take a value from one of the column in datagrid and convert it into integer value and accordingly display data. Code is like this

Public Sub ChangeColor(ByVal sender As Object, ByVal e As DataGridItemEventArgs)

If e.Item.ItemType <> ListItemType.Header Or e.Item.ItemType <> ListItemType.Footer Then

If Integer.Parse(e.Item.Cells(5).Text, Globalization.NumberStyles.Integer) < 60 Then
e.Item.Cells(5).Text = e.Item.Cells(5).Text + "Min"
End If


End If

I have tried Ctype, Convert and now trying with Integer.Parse but all of them give the same error

Exception Details: System.FormatException: Input string was not in a correct format

Please can some body help me in such a stupid problem :( Pleaseeee ?

Thanking you all in advance

 
The If statement will ALWAYS be true because of the OR

If e.Item.ItemType <> ListItemType.Header Or e.Item.ItemType <> ListItemType.Footer Then

Maybe
If Not(e.Item.ItemType = ListItemType.Header Orelse e.Item.ItemType = ListItemType.Footer) Then


Forms/Controls Resizing/Tabbing
Compare Code
Generate Sort Class in VB
Check To MS)
 
High jhon i even tried that but nothing same error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top