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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes in 2dimensional array

Status
Not open for further replies.

N3XuS

Programmer
Mar 1, 2002
339
BE
Code:
        Dim chkWeek(6)() As CheckBox
        For j = 0 To 6
            For i = 0 To 23
                Dim chkBox As New CheckBox
                chkBox.Text = i
                chkBox.Width = Unit.Pixel(40)
                chkWeek(j)(i) = chkBox
I get an error Object reference not set to an instance of an object. on chkWeek(j)(i) = chkBox.
When I make the array into a single dimension I don't get this error and it works fine (except I don't have a 2 dimensional array then obviously :)) I know I can simulate a 2 dimensional array with a single dimension, but I'ld rather not. Why is it saying it's not initialized ????

Thx
 
Code:
Dim chkBox As New CheckBox
chkBox.Text = i
chkBox.Width = Unit.Pixel(40)

ok, so its a checkbox, where is it?
what object do i assign these values to in my aspx page?

i think ive been in your boat, are you trying to dynamically assing vals to a slew of boxes? or just create them depending on something?

so 24 checkboxes 6 times?

try swapping them around...

Dim chkBox As New CheckBox
chkWeek(j)(i) = chkBox
chkBox.Text = i
chkBox.Width = Unit.Pixel(40)



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top