1 Replies - 4771 Views - Last Post: 16 February 2012 - 04:26 PM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 133
  • Joined: 11-March 11

Allow Null values in listview?

Posted 16 February 2012 - 02:21 PM


I've come across an error I'm not quite sure how to get rid of, I've got a listview with listview items making up the grid, I've got values coming from a database populating the cells however if there are any null values(in this case, there's null values in the date) it crashes my program. I'm not quite sure of a way to allow the listview to have null values in it, I figured it would default allow it but that's not the case.
itm.Text = m_Queue_rs.Fields(0).Value
                    itm.SubItems.Add(m_Queue_rs.Fields(7).Value)' This is where the error is occuring, it's fine if there's a value to put into the cell but once it becomes null it spits it out, I would like to know if there's a way for it to accept nulls.
                        itm.SubItems.Add(GetCodeTranslations("AuthQueueStatus", m_Queue_rs.Fields(8).Value))

Error is:
Overload resolution failed because no Public 'Add' is most specific for these arguments:
'Public Function add(text As String) As System.Windows.Forms.ListViewItem.ListViewSubItem':
Not most specifc
'Public Function Add(item as System.Windows.Forms.ListViewItem.ListViewSubItem) As System.Windows.Forms.ListViewItem':
Not most specific

This post has been edited by Criel: 16 February 2012 - 02:23 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Allow Null values in listview?

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1721
  • View blog
  • Posts: 5,636
  • Joined: 25-September 09

Re: Allow Null values in listview?

Posted 16 February 2012 - 04:26 PM

I'm pretty sure this work:
If not you could
1. Check for null and input a blank string instead of trying to insert the null entry
2. Append an empty string to what you have
itm.SubItems.Add(m_Queue_rs.Fields(7).Value & "")
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1