![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Nullable Type Hello all, I'm trying to do the following: int my = null ?? Convert.ToInt32(row.Cells[2].Value) as ow.Cells [2].Value could be null. Obviously this isn't working. What's the best way to get a value from the cell into the nullable int? Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Nullable Type "Jon" <jonmyates@newsgroup> wrote in message news:c8e34b06-75b1-4809-9e8f-efaaf33ed26f@newsgroup Quote: > Hello all, > > I'm trying to do the following: > > int my = null ?? Convert.ToInt32(row.Cells[2].Value) as ow.Cells > [2].Value could be null. > > Obviously this isn't working. > > What's the best way to get a value from the cell into the nullable > int? > > Thanks Nullable<int> my = null; if(row.Cells[2].Value != DBNull.value) { my = Convert.ToInt32(row.Cells[2].Value); } -Scott |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Nullable Type On 6 Nov, 14:56, "Scott M." <s-...@newsgroup> wrote: Quote: > "Jon" <jonmya...@newsgroup> wrote in message > > news:c8e34b06-75b1-4809-9e8f-efaaf33ed26f@newsgroup > Quote: > > Hello all, Quote: > > I'm trying to do the following: Quote: > > int my = null ?? Convert.ToInt32(row.Cells[2].Value) as ow.Cells > > [2].Value could be null. Quote: > > Obviously this isn't working. Quote: > > What's the best way to get a value from the cell into the nullable > > int? Quote: > > Thanks > How about (psuedo code): > > Nullable<int> my = null; > if(row.Cells[2].Value != DBNull.value) > { > * *my = Convert.ToInt32(row.Cells[2].Value); > > } > > -Scott |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Display actual file type, not description of the type | Vista file management | |||
| Display the actual type, rather than the description of the type | Vista General | |||
| Solved: Nullable types in PowerShell | PowerShell | |||
| Unable to find type [Drawing.Image]: make sure that the assembly containing this type is loaded | PowerShell | |||
| Nullable type support? | PowerShell | |||