Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 15, 2012 07:06 AM by deepakdelight
Participant
1090 Points
659 Posts
Feb 09, 2012 05:22 PM|LINK
Hello Everyone and thanks for your help in advance. I am trying to load an array from a dataview using the following code:
Public Queue As String() = Nothing
Dim Patients As DataView
Dim Patient As DataRowView
Dim QueueCounter As Integer = 0
For Each Patient In Patients
Queue(QueueCounter) = Trim(Patient("Ins1CertNmbr").ToString)
QueueCounter = QueueCounter + 1
Next
However, I am receiving an error message of not set to an object. I ahve verified that the datacolumn is not NULL, so that is not the issue. I'm not sure why this error is happening.
All-Star
112752 Points
18373 Posts
Moderator
Feb 09, 2012 05:37 PM|LINK
You need to initialize the Queue array. Currently you've set it to Nothing.
1292 Points
207 Posts
Feb 09, 2012 05:51 PM|LINK
Along the lines of what Metal said, you can set the string array to your dataview count -1. Something like (providing the dataview is filled already);
Dim Queue(Patients.Count - 1) As String
Member
20 Points
6 Posts
Feb 15, 2012 07:06 AM|LINK
Dim label1 As New Label
dim c as integer
c=0
label1.ID = "Label"& c.ToString
label1.text= Trim(Patient("Ins1CertNmbr").ToString)
c=c+1
Here you can get the value by refering the text property of
label0.text
label1.text
label2.text so on....
try.
kmcnet
Participant
1090 Points
659 Posts
Problem with Array
Feb 09, 2012 05:22 PM|LINK
Hello Everyone and thanks for your help in advance. I am trying to load an array from a dataview using the following code:
Public Queue As String() = Nothing
Dim Patients As DataView
Dim Patient As DataRowView
Dim QueueCounter As Integer = 0
For Each Patient In Patients
Queue(QueueCounter) = Trim(Patient("Ins1CertNmbr").ToString)
QueueCounter = QueueCounter + 1
Next
However, I am receiving an error message of not set to an object. I ahve verified that the datacolumn is not NULL, so that is not the issue. I'm not sure why this error is happening.
MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: Problem with Array
Feb 09, 2012 05:37 PM|LINK
You need to initialize the Queue array. Currently you've set it to Nothing.
ksqcoder
Participant
1292 Points
207 Posts
Re: Problem with Array
Feb 09, 2012 05:51 PM|LINK
Along the lines of what Metal said, you can set the string array to your dataview count -1. Something like (providing the dataview is filled already);
Dim Queue(Patients.Count - 1) As String
deepakdeligh...
Member
20 Points
6 Posts
Re: Problem with Array
Feb 15, 2012 07:06 AM|LINK
Dim label1 As New Label
dim c as integer
c=0
For Each Patient In Patients
label1.ID = "Label"& c.ToString
label1.text= Trim(Patient("Ins1CertNmbr").ToString)
c=c+1
Next
Here you can get the value by refering the text property of
label0.text
label1.text
label2.text so on....
try.